25#include <magic_enum.hpp>
29#include <unordered_set>
34#include <wx/tokenzr.h>
77#include <google/protobuf/any.pb.h>
78#include <api/board/board_types.pb.h>
100 void setter(
void* obj, wxAny& v )
override
104 if( !v.GetAs( &value ) )
110 wxString variantName;
115 if( !variantName.IsEmpty() )
126 footprint->
Add( newField );
134 wxAny
getter(
const void* obj )
const override
142 wxString variantName;
149 if( !variantName.IsEmpty() )
154 return wxAny(
text );
254 std::map<EDA_ITEM*, EDA_ITEM*> ptrMap;
259 if( field->IsMandatory() )
261 PCB_FIELD* existingField = GetField( field->GetId() );
262 ptrMap[field] = existingField;
263 *existingField = *field;
266 existingField->SetUuidDirect( field->m_Uuid );
267 existingField->SetParent( this );
271 PCB_FIELD* newField = static_cast<PCB_FIELD*>( field->Clone() );
272 ptrMap[field] = newField;
278 for(
PAD*
pad : aFootprint.Pads() )
280 PAD* newPad = static_cast<PAD*>( pad->Clone() );
281 ptrMap[ pad ] = newPad;
282 Add( newPad, ADD_MODE::APPEND );
286 for(
ZONE* zone : aFootprint.Zones() )
288 ZONE* newZone = static_cast<ZONE*>( zone->Clone() );
289 ptrMap[ zone ] = newZone;
290 Add( newZone, ADD_MODE::APPEND );
296 newZone->SetNetCode( -1 );
300 for(
BOARD_ITEM* item : aFootprint.GraphicalItems() )
302 BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
303 ptrMap[ item ] = newItem;
304 Add( newItem, ADD_MODE::APPEND );
310 PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
311 ptrMap[ group ] = newGroup;
312 Add( newGroup, ADD_MODE::APPEND );
320 for(
PCB_POINT* point : aFootprint.Points() )
322 PCB_POINT* newPoint = static_cast<PCB_POINT*>( point->Clone() );
323 ptrMap[ point ] = newPoint;
324 Add( newPoint, ADD_MODE::APPEND );
330 PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( ptrMap[ group ] );
332 newGroup->GetItems().clear();
334 for( EDA_ITEM* member : group->GetItems() )
336 if( ptrMap.count( member ) )
337 newGroup->AddItem( ptrMap[ member ] );
351 *
this = std::move( aFootprint );
399 std::vector<PROPERTY_BASE*> props;
403 auto getOrCreate = [&](
const wxString& aName )
409 auto prop = std::make_unique<PCB_FOOTPRINT_FIELD_PROPERTY>( aName );
413 return it->second.get();
418 if( !field->IsMandatory() )
421 if( !isFPedit && field->IsPrivate() )
424 const wxString&
name = field->GetUntranslatedName();
429 props.push_back( getOrCreate(
name ) );
432 std::vector<PCB_FIELD*> userFields;
436 if( field->IsMandatory() || ( !isFPedit && field->IsPrivate() ) )
439 userFields.push_back( field );
442 std::ranges::sort( userFields,
450 const wxString&
name = field->GetUntranslatedName();
451 props.push_back( getOrCreate(
name ) );
455 props.push_back( prop );
464 types::FootprintInstance footprint;
466 footprint.mutable_id()->set_value(
m_Uuid.AsStdString() );
467 footprint.mutable_position()->set_x_nm(
GetPosition().x );
468 footprint.mutable_position()->set_y_nm(
GetPosition().y );
471 footprint.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
472 : kiapi::common::types::LockedState::LS_UNLOCKED );
475 footprint.mutable_parent()->set_value(
board->m_Uuid.AsStdString() );
482 types::FootprintAttributes* attrs = footprint.mutable_attributes();
489 attrs->set_do_not_populate(
IsDNP() );
493 attrs->set_mounting_style( types::FootprintMountingStyle::FMS_THROUGH_HOLE );
495 attrs->set_mounting_style( types::FootprintMountingStyle::FMS_SMD );
497 attrs->set_mounting_style( types::FootprintMountingStyle::FMS_UNSPECIFIED );
501 types::FootprintDesignRuleOverrides* overrides = footprint.mutable_overrides();
515 overrides->set_zone_connection(
520 footprint.set_symbol_sheet_name(
m_sheetname.ToUTF8() );
521 footprint.set_symbol_sheet_filename(
m_sheetfile.ToUTF8() );
522 footprint.set_symbol_footprint_filters(
m_filters.ToUTF8() );
528 for(
const auto& [variantName, variant] :
m_variants )
530 types::FootprintVariant* variantMsg = footprint.add_variants();
531 variantMsg->set_name( variantName.ToUTF8() );
532 variantMsg->set_do_not_populate( variant.GetDNP() );
533 variantMsg->set_exclude_from_bill_of_materials( variant.GetExcludedFromBOM() );
534 variantMsg->set_exclude_from_position_files( variant.GetExcludedFromPosFiles() );
535 variantMsg->set_exclude_from_simulation( variant.GetExcludedFromSim() );
537 for(
const auto& [fieldName, fieldValue] : variant.GetFields() )
539 variantMsg->mutable_fields()->insert( { std::string( fieldName.ToUTF8() ),
540 std::string( fieldValue.ToUTF8() ) } );
544 aContainer.PackFrom( footprint );
555 aOutput->mutable_attributes()->set_keywords(
GetKeywords().ToUTF8() );
561 types::NetTieDefinition* netTie = aOutput->add_net_ties();
562 wxStringTokenizer tokenizer(
group,
", \t\r\n", wxTOKEN_STRTOK );
564 while( tokenizer.HasMoreTokens() )
565 netTie->add_pad_number( tokenizer.GetNextToken().ToUTF8() );
571 types::JumperSettings* jumpers = aOutput->mutable_jumpers();
576 types::JumperGroup* jumperGroup = jumpers->add_groups();
578 for(
const wxString& padName :
group )
579 jumperGroup->add_pad_names( padName.ToUTF8() );
584 if( item->IsMandatory() )
587 google::protobuf::Any* itemMsg = aOutput->add_items();
588 item->Serialize( *itemMsg );
591 for(
const PAD* item :
Pads() )
593 google::protobuf::Any* itemMsg = aOutput->add_items();
594 item->Serialize( *itemMsg );
599 google::protobuf::Any* itemMsg = aOutput->add_items();
600 item->Serialize( *itemMsg );
605 google::protobuf::Any* itemMsg = aOutput->add_items();
606 item->Serialize( *itemMsg );
611 google::protobuf::Any* itemMsg = aOutput->add_items();
612 item->Serialize( *itemMsg );
617 google::protobuf::Any* itemMsg = aOutput->add_items();
618 types::Footprint3DModel modelMsg;
619 modelMsg.set_filename(
model.m_Filename.ToUTF8() );
623 modelMsg.set_visible(
model.m_Show );
624 modelMsg.set_opacity(
model.m_Opacity );
625 itemMsg->PackFrom( modelMsg );
643 for(
const types::NetTieDefinition& netTieMsg : aInput.net_ties() )
647 for(
const std::string&
pad : netTieMsg.pad_number() )
648 group.Append( wxString::Format( wxT(
"%s, " ),
pad ) );
657 for(
const types::JumperGroup& groupMsg : aInput.jumpers().groups() )
659 std::set<wxString>
group;
661 for(
const std::string& padName : groupMsg.pad_names() )
662 group.insert( wxString::FromUTF8( padName ) );
670 for(
int layerMsg : aInput.private_layers() )
675 privateLayers.
set( layer );
683 if( !field->IsMandatory() )
689 board->UncacheChildrenById(
this );
699 for(
const google::protobuf::Any& itemMsg : aInput.items() )
707 if( itemMsg.type_url() ==
"type.googleapis.com/kiapi.board.types.Footprint3DModel" )
709 types::Footprint3DModel modelMsg;
711 if( !itemMsg.UnpackTo( &modelMsg ) )
716 model.m_Filename = wxString::FromUTF8( modelMsg.filename() );
717 model.m_Show = modelMsg.visible();
718 model.m_Opacity = modelMsg.opacity();
727 wxLogTrace(
traceApi, wxString::Format( wxS(
"Attempting to unpack unknown type %s "
728 "from footprint message, skipping" ),
729 itemMsg.type_url() ) );
737 if( item && item->Deserialize( itemMsg ) )
748 types::FootprintInstance footprint;
750 if( !aContainer.UnpackTo( &footprint ) )
757 SetLocked( footprint.locked() == kiapi::common::types::LockedState::LS_LOCKED );
759 google::protobuf::Any buf;
760 types::Field mandatoryField;
762 if( footprint.has_reference_field() )
764 mandatoryField = footprint.reference_field();
766 buf.PackFrom( mandatoryField );
770 if( footprint.has_value_field() )
772 mandatoryField = footprint.value_field();
774 buf.PackFrom( mandatoryField );
778 if( footprint.has_datasheet_field() )
780 mandatoryField = footprint.datasheet_field();
782 buf.PackFrom( mandatoryField );
786 if( footprint.has_description_field() )
788 mandatoryField = footprint.description_field();
790 buf.PackFrom( mandatoryField );
796 switch( footprint.attributes().mounting_style() )
798 case types::FootprintMountingStyle::FMS_THROUGH_HOLE:
802 case types::FootprintMountingStyle::FMS_SMD:
810 SetBoardOnly( footprint.attributes().not_in_schematic() );
815 SetDNP( footprint.attributes().do_not_populate() );
821 const types::FootprintDesignRuleOverrides& overrides = footprint.overrides();
823 if( overrides.has_copper_clearance() )
828 if( overrides.has_solder_mask() && overrides.solder_mask().has_solder_mask_margin() )
833 if( overrides.has_solder_paste() )
835 const types::SolderPasteOverrides& pasteSettings = overrides.solder_paste();
837 if( pasteSettings.has_solder_paste_margin() )
842 if( pasteSettings.has_solder_paste_margin_ratio() )
851 m_sheetname = wxString::FromUTF8( footprint.symbol_sheet_name() );
852 m_sheetfile = wxString::FromUTF8( footprint.symbol_sheet_filename() );
853 m_filters = wxString::FromUTF8( footprint.symbol_footprint_filters() );
862 for(
const types::FootprintVariant& variantMsg : footprint.variants() )
864 wxString variantName = wxString::FromUTF8( variantMsg.name() );
870 variant.
SetName( variantName );
871 variant.
SetDNP( variantMsg.do_not_populate() );
876 for(
const auto& [fieldName, fieldValue] : variantMsg.fields() )
877 variant.
SetFieldValue( wxString::FromUTF8( fieldName ), wxString::FromUTF8( fieldValue ) );
888 if( field->GetId() == aFieldType )
903 if( field->GetId() == aFieldType )
913 return GetField( aFieldName ) !=
nullptr;
921 if( field->GetName() == aFieldName )
937 if( !field->IsVisible() || field->GetText().IsEmpty() )
941 aVector.push_back( field );
944 std::sort( aVector.begin(), aVector.end(),
947 return lhs->GetOrdinal() < rhs->GetOrdinal();
953 std::vector<PCB_FIELD*>& aDetached )
955 std::deque<PCB_FIELD*> updatedFieldSet;
956 std::vector<wxString> assignedFields;
963 *existingField = sourceField;
966 updatedFieldSet.push_back( existingField );
967 assignedFields.push_back( sourceField.GetName() );
972 aAdded.push_back( destField );
973 updatedFieldSet.push_back( destField );
980 if( field.IsMandatory() )
981 assignOrAdd(
const_cast<PCB_FIELD*
>( std::as_const( *this ).GetField( field.GetId() ) ), field );
983 assignOrAdd(
GetField( field.GetName() ), field );
988 if( !field->IsMandatory() && !
alg::contains( assignedFields, field->GetName() ) )
989 aDetached.push_back( field );
1000 m_fields = std::move( updatedFieldSet );
1011 ordinal = std::max( ordinal, field->GetOrdinal() + 1 );
1018 bool aStyleShapes,
bool aStyleDimensions,
bool aStyleBarcodes )
1023 field->StyleFromSettings(
board.GetDesignSettings(),
true );
1028 switch( item->Type() )
1033 item->StyleFromSettings(
board.GetDesignSettings(),
true );
1038 if( aStyleShapes && !item->IsOnCopperLayer() )
1039 item->StyleFromSettings(
board.GetDesignSettings(),
true );
1048 if( aStyleDimensions )
1049 item->StyleFromSettings(
board.GetDesignSettings(),
true );
1054 if( aStyleBarcodes )
1055 item->StyleFromSettings(
board.GetDesignSettings(),
true );
1069 std::vector< BOARD_ITEM* > item_list;
1072 item_list.push_back( field );
1075 item_list.push_back(
pad );
1078 item_list.push_back( gr_item );
1083 item_list.push_back(
group );
1087 item_list.push_back( zone );
1091 item_list.push_back( point );
1093 bool changed =
false;
1099 item->ResetUuidDirect();
1136 board->UncacheChildrenById(
this );
1144 for(
PCB_FIELD* field : aOther.m_fields )
1147 aOther.m_fields.clear();
1155 for(
PAD*
pad : aOther.Pads() )
1158 aOther.Pads().clear();
1166 for(
ZONE* item : aOther.Zones() )
1174 item->SetNetCode( -1 );
1177 aOther.Zones().clear();
1185 for(
BOARD_ITEM* item : aOther.GraphicalItems() )
1188 aOther.GraphicalItems().clear();
1199 aOther.Groups().clear();
1210 aOther.Constraints().clear();
1218 for(
PCB_POINT* point : aOther.Points() )
1221 aOther.Points().clear();
1235 aOther.m_componentClassCacheProxy->GetStaticComponentClass() );
1238 aOther.m_fields.clear();
1239 aOther.Pads().clear();
1240 aOther.Zones().clear();
1241 aOther.GraphicalItems().clear();
1242 aOther.m_initial_comments =
nullptr;
1276 board->UncacheChildrenById(
this );
1278 std::map<EDA_ITEM*, EDA_ITEM*> ptrMap;
1289 ptrMap[field] = newField;
1302 ptrMap[
pad ] = newPad;
1314 ZONE* newZone =
static_cast<ZONE*
>( zone->Clone() );
1315 ptrMap[ zone ] = newZone;
1334 ptrMap[ item ] = newItem;
1350 newGroup->
AddItem( ptrMap[ member ] );
1374 ptrMap[ point ] = newItem;
1405 *
this = *
static_cast<const FOOTPRINT*
>( aOther );
1432 if( aSheetPath.empty() )
1436 return m_path.size() >= aSheetPath.size() - 1
1437 && std::equal( aSheetPath.begin() + 1, aSheetPath.end(),
m_path.begin() );
1443 aVars->push_back( wxT(
"REFERENCE" ) );
1444 aVars->push_back( wxT(
"VALUE" ) );
1445 aVars->push_back( wxT(
"LAYER" ) );
1446 aVars->push_back( wxT(
"FOOTPRINT_LIBRARY" ) );
1447 aVars->push_back( wxT(
"FOOTPRINT_NAME" ) );
1448 aVars->push_back( wxT(
"SHORT_NET_NAME(<pad_number>)" ) );
1449 aVars->push_back( wxT(
"NET_NAME(<pad_number>)" ) );
1450 aVars->push_back( wxT(
"NET_CLASS(<pad_number>)" ) );
1451 aVars->push_back( wxT(
"PIN_NAME(<pad_number>)" ) );
1452 aVars->push_back( wxT(
"EXCLUDE_FROM_BOM" ) );
1453 aVars->push_back( wxT(
"EXCLUDE_FROM_BOARD" ) );
1454 aVars->push_back( wxT(
"EXCLUDE_FROM_SIM" ) );
1455 aVars->push_back( wxT(
"EXCLUDE_FROM_POS_FILES" ) );
1456 aVars->push_back( wxT(
"DNP" ) );
1476 wxString variant = aVariantName;
1478 if( token->IsSameAs( wxT(
"REFERENCE" ) ) )
1481 *token = reference->GetShownText(
INTERNAL, aDepth + 1 );
1487 else if( token->IsSameAs( wxT(
"VALUE" ) ) )
1490 *token = value->GetShownText(
INTERNAL, aDepth + 1 );
1496 else if( token->IsSameAs( wxT(
"LAYER" ) ) )
1501 else if( token->IsSameAs( wxT(
"FOOTPRINT_LIBRARY" ) ) )
1503 *token =
m_fpid.GetUniStringLibNickname();
1506 else if( token->IsSameAs( wxT(
"FOOTPRINT_NAME" ) ) )
1508 *token =
m_fpid.GetUniStringLibItemName();
1511 else if( token->StartsWith( wxT(
"SHORT_NET_NAME(" ) )
1512 || token->StartsWith( wxT(
"NET_NAME(" ) )
1513 || token->StartsWith( wxT(
"NET_CLASS(" ) )
1514 || token->StartsWith( wxT(
"PIN_NAME(" ) ) )
1516 wxString padNumber = token->AfterFirst(
'(' );
1517 padNumber = padNumber.BeforeLast(
')' );
1521 if(
pad->GetNumber() == padNumber )
1523 if( token->StartsWith( wxT(
"SHORT_NET_NAME" ) ) )
1524 *token =
pad->GetShortNetname();
1525 else if( token->StartsWith( wxT(
"NET_NAME" ) ) )
1526 *token =
pad->GetNetname();
1527 else if( token->StartsWith( wxT(
"NET_CLASS" ) ) )
1528 *token =
pad->GetNetClassName();
1530 *token =
pad->GetPinFunction();
1536 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOM" ) ) )
1538 *token = wxEmptyString;
1541 *token = wxS(
"Excluded from BOM" );
1545 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_POS_FILES" ) ) )
1547 *token = wxEmptyString;
1550 *token = wxS(
"Excluded from position files" );
1554 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_BOARD" ) ) )
1557 *token = wxEmptyString;
1560 else if( token->IsSameAs( wxT(
"EXCLUDE_FROM_SIM" ) ) )
1562 *token = wxEmptyString;
1565 *token = wxS(
"Excluded from simulation" );
1569 else if( token->IsSameAs( wxT(
"DNP" ) ) )
1571 *token = wxEmptyString;
1574 *token = wxS(
"DNP" );
1580 *token = field->GetShownText(
INTERNAL, aDepth + 1 );
1584 else if( token->StartsWith( wxS(
"PROPERTY." ) ) )
1587 wxString propertyName = token->AfterFirst(
'.' );
1588 propertyName.Replace( wxS(
"_" ), wxS(
" " ) );
1594 if( !property || property->IsHiddenFromPropertiesManager() )
1624 return it !=
m_variants.end() ? &it->second :
nullptr;
1632 return it !=
m_variants.end() ? &it->second :
nullptr;
1638 if( aVariant.
GetName().IsEmpty()
1650 it->second = std::move( updated );
1660 if( aVariantName.IsEmpty()
1663 wxASSERT_MSG(
false, wxT(
"Variant name cannot be empty or default." ) );
1678 auto inserted =
m_variants.emplace( aVariantName, std::move( variant ) );
1679 return &inserted.first->second;
1691 if( aNewName.IsEmpty()
1702 auto existingIt =
m_variants.find( aNewName );
1704 if( existingIt !=
m_variants.end() && existingIt != it )
1707 if( it->first == aNewName )
1713 m_variants.emplace( aNewName, std::move( variant ) );
1732 return variant->
GetDNP();
1800 return field->GetText();
1824 switch( aBoardItem->
Type() )
1850 m_pads.push_back(
static_cast<PAD*
>( aBoardItem ) );
1852 m_pads.push_front(
static_cast<PAD*
>( aBoardItem ) );
1858 m_zones.push_back(
static_cast<ZONE*
>( aBoardItem ) );
1881 wxFAIL_MSG( wxT(
"FOOTPRINT::Add(): Markers go at the board level, even in the footprint editor" ) );
1885 wxFAIL_MSG( wxT(
"FOOTPRINT::Add(): Nested footprints not supported" ) );
1897 wxFAIL_MSG( wxString::Format( wxT(
"FOOTPRINT::Add(): BOARD_ITEM type (%d) not handled" ),
1898 aBoardItem->
Type() ) );
1910 board->CacheItemSubtreeById( aBoardItem );
1914 board->noteDrillModelChange( aBoardItem );
1923 switch( aBoardItem->
Type() )
1928 if( *it == aBoardItem )
1930 const wxString fieldName = ( *it )->GetUntranslatedName();
1934 for(
auto& [variantName, footprintVariant] :
m_variants )
1935 footprintVariant.RemoveFieldValue( fieldName );
1956 if( *it == aBoardItem )
1966 for(
auto it =
m_pads.begin(); it !=
m_pads.end(); ++it )
1968 if( *it ==
static_cast<PAD*
>( aBoardItem ) )
1980 if( *it ==
static_cast<ZONE*
>( aBoardItem ) )
2004 if( *it ==
static_cast<PCB_GROUP*
>( aBoardItem ) )
2014 wxFAIL_MSG( wxT(
"FOOTPRINT::Remove(): Markers go at the board level, even in the footprint editor" ) );
2018 wxFAIL_MSG( wxT(
"FOOTPRINT::Remove(): Nested footprints not supported" ) );
2024 if( *it ==
static_cast<PCB_POINT*
>( aBoardItem ) )
2034 wxFAIL_MSG( wxString::Format( wxT(
"FOOTPRINT::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
2035 aBoardItem->
Type() ) );
2041 if(
board->IsItemIndexedById(
this ) )
2043 board->UncacheItemSubtreeById( aBoardItem );
2044 board->noteDrillModelChange( aBoardItem );
2047 board->IncrementTimeStamp();
2073 switch(
pad->GetProperty() )
2091 switch(
pad->GetAttribute() )
2098 if(
pad->IsOnCopperLayer() )
2126 return _(
"Through hole" );
2128 return _(
"Unspecified" );
2164 wxStringTokenizer keywordTokenizer(
GetKeywords(), wxS(
" \t\r\n" ), wxTOKEN_STRTOK );
2166 while( keywordTokenizer.HasMoreTokens() )
2187 if(
dummy.IsFlipped() )
2191 bbox.
Merge(
pad->GetBoundingBox() );
2241 std::vector<PCB_TEXT*> texts;
2242 bool isFPEdit =
board &&
board->IsFootprintHolder();
2263 texts.push_back(
static_cast<PCB_TEXT*
>( item ) );
2281 bbox.
Merge( item->GetBoundingBox() );
2287 if( field->IsReference() || field->IsValue() )
2290 texts.push_back( field );
2294 bbox.
Merge(
pad->GetBoundingBox() );
2297 bbox.
Merge( zone->GetBoundingBox() );
2300 bbox.
Merge( point->GetBoundingBox() );
2305 if( aIncludeText || noDrawItems )
2328 bool valueLayerIsVisible =
true;
2329 bool refLayerIsVisible =
true;
2339 valueLayerIsVisible =
board->IsLayerVisible( value->
GetLayer() )
2346 refLayerIsVisible =
board->IsLayerVisible( reference->
GetLayer() )
2353 if( value && ( ( value->
IsVisible() && valueLayerIsVisible ) || noDrawItems ) )
2356 if( reference && ( ( reference->
IsVisible() && refLayerIsVisible ) || noDrawItems ) )
2367 if( aIncludeText || noDrawItems )
2385 std::vector<PCB_TEXT*> texts;
2387 bool isFPEdit =
board &&
board->IsFootprintHolder();
2397 if( ( aLayers & item->GetLayerSet() ).none() )
2405 bbox.
Merge( item->GetBoundingBox() );
2410 if( ( aLayers &
pad->GetLayerSet() ).none() )
2413 bbox.
Merge(
pad->GetBoundingBox() );
2418 if( ( aLayers & zone->GetLayerSet() ).none() )
2421 bbox.
Merge( zone->GetBoundingBox() );
2429 if( ( aLayers & point->GetLayerSet() ).none() )
2432 bbox.
Merge( point->GetBoundingBox() );
2442 bool isFPEdit =
board &&
board->IsFootprintHolder();
2467 pad->Padstack().ForEachUniqueLayer(
2481 const SHAPE_POLY_SET& layerPoly = *zone->GetFilledPolysList( layer );
2497 const int halfsize =
pcbIUScale.mmToIU( 1.0 );
2508 std::vector<VECTOR2I> convex_hull;
2520 for(
const VECTOR2I& pt : convex_hull )
2534 bool isFPEdit =
board &&
board->IsFootprintHolder();
2544 if( item->IsOnLayer( aLayer ) )
2555 if(
pad->IsOnLayer( aLayer ) )
2561 if( zone->GetIsRuleArea() )
2564 if( zone->IsOnLayer( aLayer ) )
2566 const std::shared_ptr<SHAPE_POLY_SET>& layerPoly = zone->GetFilledPolysList( aLayer );
2568 for(
int ii = 0; ii < layerPoly->OutlineCount(); ii++ )
2569 rawPolys.
AddOutline( layerPoly->COutline( ii ) );
2573 std::vector<VECTOR2I> convex_hull;
2578 for(
const VECTOR2I& pt : convex_hull )
2591 variant =
board->GetCurrentVariant();
2604 aList.emplace_back(
_(
"Footprint Name" ),
GetFPID().GetLibItemName().wx_str() );
2609 wxString::Format(
_(
"Keywords: %s" ),
GetKeywords() ) );
2618 case F_Cu: aList.emplace_back(
_(
"Board Side" ),
_(
"Front" ) );
break;
2619 case B_Cu: aList.emplace_back(
_(
"Board Side" ),
_(
"Back (Flipped)" ) );
break;
2623 aList.emplace_back(
_(
"Rotation" ), wxString::Format( wxT(
"%.4g" ),
GetOrientation().AsDegrees() ) );
2625 auto addToken = []( wxString* aStr,
const wxString& aAttr )
2627 if( !aStr->IsEmpty() )
2628 *aStr += wxT(
", " );
2637 addToken( &status,
_(
"Locked" ) );
2640 addToken( &status,
_(
"autoplaced" ) );
2643 addToken( &attrs,
_(
"not in schematic" ) );
2646 addToken( &attrs,
_(
"exclude from pos files" ) );
2649 addToken( &attrs,
_(
"exclude from BOM" ) );
2652 addToken( &attrs,
_(
"exclude from simulation" ) );
2655 addToken( &attrs,
_(
"DNP" ) );
2657 aList.emplace_back(
_(
"Status: " ) + status,
_(
"Attributes:" ) + wxS(
" " ) + attrs );
2661 aList.emplace_back(
_(
"Component Class" ),
2665 msg.Printf(
_(
"Footprint: %s" ),
m_fpid.GetUniStringLibId() );
2667 aList.emplace_back( msg, msg2 );
2671 aList.emplace_back( msg, msg2 );
2679 if(
board->IsFootprintHolder() )
2711 if(
pad->IsOnLayer( aLayer ) )
2717 if( zone->IsOnLayer( aLayer ) )
2723 if( field->IsOnLayer( aLayer ) )
2729 if( item->IsOnLayer( aLayer ) )
2741 if(
pad->IsOnLayer( aLayer ) &&
pad->HitTest( aPosition, aAccuracy ) )
2747 if( zone->IsOnLayer( aLayer ) && zone->HitTest( aPosition, aAccuracy ) )
2753 if( item->Type() !=
PCB_TEXT_T && item->IsOnLayer( aLayer )
2754 && item->HitTest( aPosition, aAccuracy ) )
2766 std::vector<BOARD_ITEM*> items;
2770 if(
pad->IsOnLayer( aLayer ) )
2771 items.push_back(
pad );
2776 if( zone->IsOnLayer( aLayer ) )
2777 items.push_back( zone );
2782 if( item->Type() !=
PCB_TEXT_T && item->IsOnLayer( aLayer ) )
2783 items.push_back( item );
2792 if( !aContained && item->HitTest( aRect, aContained, aAccuracy ) )
2794 else if( aContained && !item->HitTest( aRect, aContained, aAccuracy ) )
2801 return !items.empty() && aContained;
2820 BOX2I arect = aRect;
2840 if(
pad->HitTest( arect,
false, 0 ) )
2846 if( zone->HitTest( arect,
false, 0 ) )
2852 if( point->HitTest( arect,
false, 0 ) )
2863 if( item->Type() !=
PCB_TEXT_T && item->HitTest( arect,
false, 0 ) )
2877 using std::ranges::all_of;
2878 using std::ranges::any_of;
2885 [&](
const auto* aItem )
2887 return aItem && aItem->HitTest( aPoly, aContained );
2893 auto drawings =
m_drawings | std::views::filter( [](
const auto* aItem )
2904 return all_of( drawings, hitTest )
2905 && all_of(
m_pads, hitTest )
2906 && all_of(
m_zones, hitTest );
2911 return any_of( drawings, hitTest )
2912 || any_of(
m_pads, hitTest )
2913 || any_of(
m_zones, hitTest );
2920 bool can_select = aSearchAfterMe ? false :
true;
2924 if( !can_select &&
pad == aSearchAfterMe )
2930 if( can_select &&
pad->GetNumber() == aPadNumber )
2942 if(
pad->m_Uuid == aUuid )
2955 if( !(
pad->GetLayerSet() & aLayerMask ).any() )
2958 if(
pad->HitTest( aPosition ) )
2968 std::vector<const PAD*> retv;
2972 if( ( aIgnore && aIgnore ==
pad ) || (
pad->GetNumber() != aPadNumber ) )
2975 retv.push_back(
pad );
2990 std::set<wxString> usedNumbers;
3002 if(
pad->GetNumber().IsEmpty() )
3005 usedNumbers.insert(
pad->GetNumber() );
3030 auto isElectricalPadNumber =
3031 [](
const wxString& num ) ->
bool
3038 while( i < num.size() && wxIsalpha( num[i] ) )
3046 if( i == num.size() )
3049 for(
size_t j = i; j < num.size(); ++j )
3051 if( !wxIsdigit( num[j] ) )
3058 std::set<wxString> counted;
3070 const wxString& num =
pad->GetNumber();
3072 if( isElectricalPadNumber( num ) )
3074 counted.insert( num );
3076 else if( num.Contains(
'_' ) )
3078 wxString first, second;
3079 first = num.BeforeFirst(
'_', &second );
3081 if( isElectricalPadNumber( first ) && isElectricalPadNumber( second ) )
3083 counted.insert( first );
3084 counted.insert( second );
3089 return static_cast<unsigned>( counted.size() );
3095 if(
nullptr == a3DModel )
3138 const std::vector<KICAD_T>& aScanTypes )
3140#if 0 && defined(DEBUG)
3141 std::cout <<
GetClass().mb_str() <<
' ';
3144 bool drawingsScanned =
false;
3146 for(
KICAD_T scanType : aScanTypes )
3185 if( !drawingsScanned )
3190 drawingsScanned =
true;
3229 if( reference.IsEmpty() )
3230 reference =
_(
"<no reference designator>" );
3232 return wxString::Format(
_(
"Footprint %s" ), reference );
3238 return wxString::Format( wxT(
"%s (%s)" ),
3273 aFunction( constraint );
3280 aFunction( drawing );
3286 catch( std::bad_function_call& )
3288 wxFAIL_MSG( wxT(
"Error running FOOTPRINT::RunOnChildren" ) );
3295 std::vector<int> layers;
3297 layers.reserve( 6 );
3303 wxASSERT_MSG(
false, wxT(
"Illegal layer" ) );
3320 bool f_silk =
false, b_silk =
false, non_silk =
false;
3324 if( item->GetLayer() ==
F_SilkS )
3326 else if( item->GetLayer() ==
B_SilkS )
3332 if( ( f_silk || b_silk ) && !non_silk &&
m_pads.empty() )
3369 constexpr double MINIMAL_ZOOM_LEVEL_FOR_VISIBILITY = 1.5;
3372 return MINIMAL_ZOOM_LEVEL_FOR_VISIBILITY;
3385 int biggest_clearance =
board->GetMaxClearanceValue();
3386 area.
Inflate( biggest_clearance );
3397 if( aName.find_first_of( invalids ) != std::string::npos )
3409 static const wxChar invalidCharsReadable[] = wxT(
"% $ < > 'tab' 'return' 'line feed' \\ \" / :");
3412 return invalidCharsReadable;
3414 return invalidChars.wc_str();
3420 if( aMoveVector.
x == 0 && aMoveVector.
y == 0 )
3434 EDA_ANGLE newOrientation = orientation + aAngle;
3441 field->KeepUpright();
3446 static_cast<PCB_TEXT*
>( item )->KeepUpright();
3453 wxASSERT( aLayer ==
F_Cu || aLayer ==
B_Cu );
3508 field->OnFootprintTransformed();
3511 pad->OnFootprintTransformed();
3514 zone->OnFootprintTransformed();
3522 item->OnFootprintTransformed();
3527 point->OnFootprintTransformed();
3568 if( !std::isfinite( aScaleX ) || !std::isfinite( aScaleY ) || aScaleX <= 0.0 || aScaleY <= 0.0 )
3573 const double ratioX = aScaleX / oldSx;
3574 const double ratioY = aScaleY / oldSy;
3575 const double linearFactor = ( aScaleX + aScaleY ) / ( oldSx + oldSy );
3583 pad->OnFootprintRescaled( ratioX, ratioY, linearFactor,
anchor, parentRotate );
3586 field->OnFootprintRescaled( ratioX, ratioY, linearFactor,
anchor, parentRotate );
3589 item->OnFootprintRescaled( ratioX, ratioY, linearFactor,
anchor, parentRotate );
3592 zone->OnFootprintRescaled( ratioX, ratioY, linearFactor,
anchor, parentRotate );
3595 point->OnFootprintTransformed();
3623 field->OnFootprintTransformed();
3626 pad->OnFootprintTransformed();
3629 zone->OnFootprintTransformed();
3632 point->OnFootprintTransformed();
3640 item->OnFootprintTransformed();
3644 item->Move(
delta );
3684 field->Move( moveVector );
3688 pad->Move( moveVector );
3692 item->Move( moveVector );
3696 zone->Move( moveVector );
3700 point->Move( moveVector );
3739 field->OnFootprintTransformed();
3742 pad->OnFootprintTransformed();
3745 zone->OnFootprintTransformed();
3748 point->OnFootprintTransformed();
3756 item->OnFootprintTransformed();
3760 item->Rotate( rotationCenter, angleChange );
3787 std::map<KIID, KIID> idMap;
3794 idMap[oldId] = child->
m_Uuid;
3799 constraint->RemapKIIDs( idMap );
3806 const BOARD_ITEM* aItem,
bool addToFootprint )
3810 switch( aItem->
Type() )
3814 PAD* new_pad =
new PAD( *
static_cast<const PAD*
>( aItem ) );
3817 if( addToFootprint )
3818 m_pads.push_back( new_pad );
3826 ZONE* new_zone =
new ZONE( *
static_cast<const ZONE*
>( aItem ) );
3829 if( addToFootprint )
3830 m_zones.push_back( new_zone );
3832 new_item = new_zone;
3841 if( addToFootprint )
3844 new_item = new_point;
3856 switch(
static_cast<const PCB_FIELD*
>( aItem )->GetId() )
3865 if( addToFootprint )
3868 new_item = new_text;
3877 if( addToFootprint )
3880 new_item = new_shape;
3889 if( addToFootprint )
3892 new_item = new_barcode;
3901 if( addToFootprint )
3904 new_item = new_image;
3913 if( addToFootprint )
3916 new_item = new_textbox;
3929 if( addToFootprint )
3932 new_item = dimension;
3938 new_item = aItem->
Duplicate( addToParentGroup, aCommit );
3940 if( addToFootprint )
3950 if( addToFootprint )
3952 group->RunOnChildren(
3972 wxFAIL_MSG( wxT(
"Duplication not supported for items of class " ) + aItem->
GetClass() );
3982 std::set<wxString> usedNumbers;
3986 usedNumbers.insert(
pad->GetNumber() );
3993 while( usedNumbers.count( wxString::Format( wxT(
"%s%d" ), prefix, num ) ) )
3996 return wxString::Format( wxT(
"%s%d" ), prefix, num );
4004 if(
group.contains( aPadNumber ) )
4008 return std::nullopt;
4059 for(
int jj = 0; jj < aPolySet.
HoleCount( ii ); jj++ )
4063 return aPolySet.
Area();
4078 return markerShape.
Area();
4082 double combinedArea = 0.0;
4087 return combinedArea;
4138 double width =
static_cast<const PCB_TRACK*
>( aItem )->GetWidth();
4139 return width * width;
4143 static_cast<const PAD*
>( aItem )->Padstack().ForEachUniqueLayer(
4153 const ZONE* zone =
static_cast<const ZONE*
>( aItem );
4203 for(
int i = 0; i < aCollector.
GetCount(); ++i )
4207 switch( item->
Type() )
4239 double footprintRegionArea =
polygonArea( footprintRegion );
4240 double uncoveredRegionArea = footprintRegionArea -
polygonArea( coveredRegion );
4241 double coveredArea = footprintRegionArea - uncoveredRegionArea;
4244 if( footprintRegionArea == 0 )
4247 double ratio = coveredArea / footprintRegionArea;
4254 return std::min( ratio, 1.0 );
4261 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
4282 shape->AddShape(
pad->GetEffectiveShape( aLayer, aFlash, aUsage )->Clone() );
4287 shape->AddShape( item->GetEffectiveShape( aLayer, aFlash, aUsage )->Clone() );
4289 shape->AddShape( item->GetEffectiveShape( aLayer, aFlash, aUsage )->Clone() );
4336 std::vector<PCB_SHAPE*> list_front;
4337 std::vector<PCB_SHAPE*> list_back;
4338 std::map<int, int> front_width_histogram;
4339 std::map<int, int> back_width_histogram;
4346 list_back.push_back( shape );
4353 list_front.push_back( shape );
4358 if( !list_front.size() && !list_back.size() )
4362 int chainingEpsilon =
pcbIUScale.mmToIU( 0.02 );
4365 true, aErrorHandler ) )
4375 auto max = std::max_element( front_width_histogram.begin(), front_width_histogram.end(),
4376 [](
const std::pair<int, int>& a,
const std::pair<int, int>& b )
4378 return a.second < b.second;
4381 if( max != front_width_histogram.end() )
4404 auto max = std::max_element( back_width_histogram.begin(), back_width_histogram.end(),
4405 [](
const std::pair<int, int>& a,
const std::pair<int, int>& b )
4407 return a.second < b.second;
4410 if( max != back_width_histogram.end() )
4433 std::map<PCB_LAYER_ID, std::vector<PCB_SHAPE*>> layer_shapes;
4439 if( item->Type() != PCB_SHAPE_T )
4442 for( PCB_LAYER_ID layer : item->GetLayerSet() )
4444 if( !IsCopperLayer( layer ) )
4447 if( board && !board->GetEnabledLayers().Contains( layer ) )
4450 layer_shapes[layer].push_back( static_cast<PCB_SHAPE*>( item ) );
4454 for(
size_t ii = 0; ii < m_pads.size(); ++ii )
4457 bool has_nettie =
false;
4459 auto it = map.find(
pad->GetNumber() );
4461 if( it == map.end() || it->second < 0 )
4464 for(
size_t jj = 0; jj < m_pads.size(); ++jj )
4469 PAD* other = m_pads[ jj ];
4471 auto it2 = map.find( other->
GetNumber() );
4473 if( it2 == map.end() || it2->second < 0 )
4476 if( it2->second == it->second )
4478 m_netTieCache[
pad].insert(
pad->GetNetCode() );
4480 m_netTieCache[other].insert( other->
GetNetCode() );
4481 m_netTieCache[other].insert(
pad->GetNetCode() );
4489 for(
auto& [ layer, shapes ] : layer_shapes )
4491 auto pad_shape =
pad->GetEffectiveShape( layer );
4493 for(
auto other_shape : shapes )
4495 auto shape = other_shape->GetEffectiveShape( layer );
4497 if( pad_shape->Collide( shape.get() ) )
4499 std::set<int>& nettie = m_netTieCache[
pad];
4500 m_netTieCache[other_shape].insert( nettie.begin(), nettie.end() );
4510 std::map<wxString, int> padNumberToGroupIdxMap;
4513 padNumberToGroupIdxMap[
pad->GetNumber() ] = -1;
4516 [&]( wxString aPad,
int aGroup )
4518 aPad.Trim(
true ).Trim(
false );
4520 if( !aPad.IsEmpty() )
4521 padNumberToGroupIdxMap[ aPad ] = aGroup;
4530 for( wxUniCharRef ch :
group )
4539 switch(
static_cast<unsigned char>( ch ) )
4546 processPad(
pad, ii );
4556 processPad(
pad, ii );
4559 return padNumberToGroupIdxMap;
4569 int groupIdx = padToNetTieGroupMap[ aPad->
GetNumber() ];
4570 std::vector<PAD*> otherPads;
4576 if( padToNetTieGroupMap[
pad->GetNumber() ] == groupIdx )
4577 otherPads.push_back(
pad );
4590 if( setAttr && likelyAttr && setAttr != likelyAttr )
4594 switch( likelyAttr )
4597 msg.Printf(
_(
"(expected 'Through hole'; actual '%s')" ),
GetTypeName() );
4600 msg.Printf(
_(
"(expected 'SMD'; actual '%s')" ),
GetTypeName() );
4605 (aErrorHandler)( msg );
4611 const std::function<
void(
const PAD*,
int,
4612 const wxString& )>& aErrorHandler )
4614 if( aErrorHandler ==
nullptr )
4619 pad->CheckPad( aUnitsProvider,
false,
4620 [&](
int errorCode,
const wxString& msg )
4622 aErrorHandler(
pad, errorCode, msg );
4629 const VECTOR2I& )>& aErrorHandler )
4631 std::unordered_map<PTR_PTR_CACHE_KEY, int> checkedPairs;
4646 if(
static_cast<void*
>( a ) >
static_cast<void*
>( b ) )
4649 if( checkedPairs.find( { a, b } ) == checkedPairs.end() )
4651 checkedPairs[ { a, b } ] = 1;
4668 if( holeA->Collide( holeB->GetSeg(), 0 ) )
4685 SHAPE* padShape =
pad->GetEffectiveShape( l ).get();
4688 if( padShape->
Collide( otherShape, 0,
nullptr, &pos ) )
4701 const VECTOR2I& )>& aErrorHandler )
4710 std::vector<BOARD_ITEM*> copperItems;
4714 if( item->IsOnCopperLayer() )
4715 copperItems.push_back( item );
4717 item->RunOnChildren(
4721 copperItems.push_back( descendent );
4728 if( !zone->GetIsRuleArea() && zone->IsOnCopperLayer() )
4729 copperItems.push_back( zone );
4734 if( field->IsOnCopperLayer() )
4735 copperItems.push_back( field );
4745 std::map<int, std::vector<const PAD*>> outlineIdxToPadsMap;
4749 if( item->IsOnLayer( layer ) )
4759 for(
int ii = 0; ii < copperOutlines.
OutlineCount(); ++ii )
4761 if(
pad->GetEffectiveShape( layer )->Collide( &copperOutlines.
Outline( ii ), 0 ) )
4762 outlineIdxToPadsMap[ ii ].emplace_back(
pad );
4769 for(
const auto& [ outlineIdx, pads ] : outlineIdxToPadsMap )
4771 if( pads.size() > 1 )
4773 const PAD* firstPad = pads[0];
4774 int firstGroupIdx = padNumberToGroupIdxMap[ firstPad->
GetNumber() ];
4776 for(
size_t ii = 1; ii < pads.size(); ++ii )
4778 const PAD* thisPad = pads[ii];
4779 int thisGroupIdx = padNumberToGroupIdxMap[ thisPad->
GetNumber() ];
4781 if( thisGroupIdx < 0 || thisGroupIdx != firstGroupIdx )
4790 if( item->HitTest( pos, 1 ) )
4792 shortingItem = item;
4798 aErrorHandler( shortingItem, firstPad, thisPad, pos );
4800 aErrorHandler( firstPad, thisPad,
nullptr, pos );
4811 std::set<wxString> padNumbers;
4820 msg.Printf(
_(
"(net-tie pad group contains unknown pad number %s)" ), padNumber );
4821 aErrorHandler( msg );
4823 else if( !padNumbers.insert(
pad->GetNumber() ).second )
4825 msg.Printf(
_(
"(pad %s appears in more than one net-tie pad group)" ), padNumber );
4826 aErrorHandler( msg );
4834 const VECTOR2I& aPt )>& aErrorHandler )
4836 auto checkColliding =
4851 if( itemShape->Collide( otherShape.get(), 0, &
actual, &pos ) )
4852 aErrorHandler( item, other, pos );
4861 checkColliding( item, other );
4865 checkColliding( item,
pad );
4876 std::swap( *
this, *
image );
4885 image->RunOnChildren(
4913 return *
this == other;
4922 for(
size_t ii = 0; ii <
m_pads.size(); ++ii )
4931 for(
size_t ii = 0; ii <
m_drawings.size(); ++ii )
4940 for(
size_t ii = 0; ii <
m_zones.size(); ++ii )
4950 std::vector<PCB_FIELD*> fields, otherFields;
4955 if( fields.size() != otherFields.size() )
4958 for(
size_t ii = 0; ii < fields.size(); ++ii )
4962 if( !( *fields[ii] == *otherFields[ii] ) )
4978 double similarity = 1.0;
4987 similarity *=
pad->Similarity( *otherPad );
4999 if( aPtA.
x != aPtB.
x )
5000 return aPtA.
x < aPtB.
x;
5002 if( aPtA.
y != aPtB.
y )
5003 return aPtA.
y < aPtB.
y;
5005 return std::nullopt;
5011 if( itemA->
Type() != itemB->
Type() )
5012 return itemA->
Type() < itemB->
Type();
5017 switch( itemA->
Type() )
5139 return itemA < itemB;
5151 std::optional<bool> padCopperMatches;
5154 const PAD* checkPad = aFirst;
5167 padCopperMatches = aFirst->
GetSize( aLayer ).
x < aSecond->
GetSize( aLayer ).
x;
5169 padCopperMatches = aFirst->
GetSize( aLayer ).
y < aSecond->
GetSize( aLayer ).
y;
5171 padCopperMatches = aFirst->
GetShape( aLayer ) < aSecond->
GetShape( aLayer );
5174 if( padCopperMatches.has_value() )
5175 return *padCopperMatches;
5183 return aFirst < aSecond;
5188bool FOOTPRINT::cmp_padstack::operator()(
const PAD* aFirst,
const PAD* aSecond )
const
5228 if( firstShape->VertexCount() != secondShape->VertexCount() )
5229 return firstShape->VertexCount() < secondShape->VertexCount();
5231 for(
int ii = 0; ii < firstShape->VertexCount(); ++ii )
5233 if( std::optional<bool> cmp =
cmp_points_opt( firstShape->CVertex( ii ), secondShape->CVertex( ii ) ) )
5267 return aFirst < aSecond;
5272 int aMaxError,
ERROR_LOC aErrorLoc )
const
5283 clearance.x +=
pad->GetSolderMaskExpansion( padLayer );
5284 clearance.y +=
pad->GetSolderMaskExpansion( padLayer );
5307 if( dummySize.
x <= 0 || dummySize.
y <= 0 )
5311 dummy.SetSize( padLayer, dummySize );
5312 dummy.TransformShapeToPolygon( aBuffer, padLayer, 0, aMaxError, aErrorLoc );
5316 pad->TransformShapeToPolygon( aBuffer, padLayer,
clearance.x, aMaxError, aErrorLoc );
5322 if( !
pad->FlashLayer( aLayer ) )
5327 pad->Padstack().ForEachUniqueLayer(
5330 processPad(
pad, l );
5335 processPad(
pad, aLayer );
5342 int aError,
ERROR_LOC aErrorLoc,
bool aIncludeText,
5343 bool aIncludeShapes,
bool aIncludePrivateItems )
const
5350 if( item->Type() ==
PCB_TEXT_T && aIncludeText )
5355 text->TransformTextToPolySet( aBuffer, aClearance, aError, aErrorLoc );
5366 textbox->PCB_SHAPE::TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
5373 if( item->Type() ==
PCB_SHAPE_T && aIncludeShapes )
5394 if( ( aLayer ==
UNDEFINED_LAYER || field->GetLayer() == aLayer ) && field->IsVisible() )
5395 field->TransformTextToPolySet( aBuffer, aClearance, aError, aErrorLoc );
5405 std::set<KIFONT::OUTLINE_FONT*>
fonts;
5419 if( permission == PERMISSION::EDITABLE || permission == PERMISSION::INSTALLABLE )
5420 fonts.insert( outlineFont );
5426 processItem( item );
5429 processItem( field );
5443 wxLogTrace(
"EMBED",
"Failed to add font file: %s", font->GetFileName() );
5481 return wxEmptyString;
5486 const std::unordered_set<wxString>& aComponentClassNames )
5535 LSET padLayers =
pad->GetLayerSet();
5536 padLayers |= boardCopper;
5537 pad->SetLayerSet( padLayers );
5554 if( zcMap.
Choices().GetCount() == 0 )
5566 if( layerEnum.
Choices().GetCount() == 0 )
5574 wxPGChoices fpLayers;
5585 auto isNotFootprintHolder =
5591 return !
board->IsFootprintHolder();
5615 const wxString groupFields =
_HKI(
"Fields" );
5621 const wxString propertyFields =
_HKI(
"Footprint Properties" );
5639 const wxString groupAttributes =
_HKI(
"Attributes" );
5659 const wxString groupOverrides =
_HKI(
"Overrides" );
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
std::unique_ptr< EDA_ITEM > CreateItemForType(KICAD_T aType, EDA_ITEM *aContainer)
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
constexpr EDA_IU_SCALE pcbIUScale
constexpr int ARC_LOW_DEF
BITMAPS
A list of all bitmap identifiers.
#define DEFAULT_COURTYARD_WIDTH
BASE_SET & set(size_t pos)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
virtual BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
Create a copy of this BOARD_ITEM.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
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.
VECTOR2I GetFPRelativePosition() const
virtual void TransformShapeToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const
Convert the item shape to a polyset.
BOARD_ITEM & operator=(const BOARD_ITEM &aOther)
BOARD_ITEM_CONTAINER * GetParent() const
virtual bool IsOnCopperLayer() const
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Information pertinent to a Pcbnew printed circuit board.
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
int GetCopperLayerCount() const
wxString GetCurrentVariant() const
COMPONENT_CLASS_MANAGER & GetComponentClassManager()
Gets the component class manager.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
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 const Vec GetCenter() const
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
constexpr coord_type GetTop() const
constexpr bool Intersects(const BOX2< Vec > &aRect) const
constexpr coord_type GetBottom() const
virtual int Accuracy() const =0
int GetCount() const
Return the number of objects in the list.
const COMPONENT_CLASS * GetStaticComponentClass() const
Gets the static component class.
COMPONENT_CLASS * GetEffectiveStaticComponentClass(const std::unordered_set< wxString > &classNames)
Gets an effective component class for the given constituent class names.
A lightweight representation of a component class.
int AsTenthsOfADegree() const
bool IsType(FRAME_T aType) const
The base class for create windows for drawing purpose.
std::unordered_set< EDA_ITEM * > & GetItems()
void AddItem(EDA_ITEM *aItem)
Add item to group.
virtual void ClearEditFlags()
void SetFlags(EDA_ITEM_FLAGS aMask)
std::vector< PROPERTY_BASE * > GetCustomPropertiesAsInspectables() const
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
static INSPECT_RESULT IterateForward(std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
This changes first parameter to avoid the DList and use the main queue instead.
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
int GetEllipseMinorRadius() const
const VECTOR2I & GetEllipseCenter() const
EDA_ANGLE GetEllipseEndAngle() const
int GetEllipseMajorRadius() const
EDA_ANGLE GetEllipseRotation() const
EDA_ANGLE GetEllipseStartAngle() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
virtual void SetVisible(bool aVisible)
double GetLineSpacing() const
virtual void SetText(const wxString &aText)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
EMBEDDED_FILES & operator=(EMBEDDED_FILES &&other) noexcept
EMBEDDED_FILE * AddFile(const wxFileName &aName, bool aOverwrite)
Load a file from disk and adds it to the collection.
bool m_embedFonts
If set, fonts will be embedded in the element on save.
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
wxString m_Filename
The 3D shape filename in 3D library.
Used when the right click button is pressed, or when the select tool is in effect.
const COLLECTORS_GUIDE * GetGuide() const
Class that other classes need to inherit from, in order to be inspectable.
wxAny Get(PROPERTY_BASE *aProperty) const
A typed sum value used to carry the before/after of any single property.
wxString ToDisplayString() const
Human-readable representation with no unit context.
FONT is an abstract base class for both outline and stroke fonts.
virtual bool IsOutline() const
Class OUTLINE_FONT implements outline font drawing.
EMBEDDING_PERMISSION GetEmbeddingPermission() const
virtual wxString GetClass() const =0
Return the class name.
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
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.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
static const LSET & SideSpecificMask()
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static const LSET & AllLayersMask()
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
static const int ORPHANED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
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::...
@ NORMAL
Shape is the same on all layers.
@ CUSTOM
Shapes can be defined on arbitrary layers.
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Return a SHAPE_SEGMENT object representing the pad's hole.
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
PAD_ATTRIB GetAttribute() const
const wxString & GetNumber() const
VECTOR2I GetPosition() const override
int GetDrillSizeX() const
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
int GetSolderMaskExpansion(PCB_LAYER_ID aLayer) const
VECTOR2I GetSize(PCB_LAYER_ID aLayer) const
const PADSTACK & Padstack() const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
PAD_DRILL_SHAPE GetDrillShape() const
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
std::optional< int > GetLocalSolderMaskMargin() 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,...
bool HasDrilledHole() const override
A geometric constraint between board items (issue #2329).
wxString GetUntranslatedName() const
Get the untranslated field name for storage, variable look-up, etc.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
PCB_FIELD * CloneField() const
Same as Clone, but returns a PCB_FIELD item.
A set of BOARD_ITEMs (i.e., without duplicates).
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
Object to handle a bitmap image that can be inserted in a PCB.
VECTOR2I GetLibraryBezierC1() const
int GetWidth() const override
void TransformShapeToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const override
Convert the item shape to a polyset.
VECTOR2I GetLibraryEnd() const
VECTOR2I GetLibraryStart() const
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.
STROKE_PARAMS GetStroke() const override
SHAPE_POLY_SET GetLibraryPolyShape() const
VECTOR2I GetLibraryBezierC2() const
VECTOR2I GetLibraryArcMid() const
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
bool IsBorderEnabled() const
Disables the border, this is done by changing the stroke internally.
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Function TransformTextToPolySet Convert the text to a polygonSet describing the actual character stro...
EDA_ANGLE GetTextAngle() const override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
int GetTextThickness() const override
void SetTextAngle(const EDA_ANGLE &aAngle) override
VECTOR2I GetTextSize() const override
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE(const wxString &aName, PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
< Used to generate unique IDs. Must come up front so it's initialized before ctor.
PROPERTY_BASE & SetGroup(const wxString &aGroup)
PROPERTY_BASE & SetIsCopyable(bool aIsCopyable=true)
virtual void SetChoices(const wxPGChoices &aChoices)
Set the possible values for for the property.
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.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
bool IsAvailableFor(TYPE_ID aItemClass, PROPERTY_BASE *aProp, INSPECTABLE *aItem)
Checks overriden availability and original availability of a property, returns false if the property ...
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
double Area(bool aAbsolute=true) const
Return the area of this chain.
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Find a point on the line chain that is closest to point aP.
Represent a set of closed polygons.
void BooleanAdd(const SHAPE_POLY_SET &b)
Perform boolean polyset union.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
double Area()
Return the area of this poly set.
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,...
int TotalVertices() const
Return total number of vertices stored in the set.
int FullPointCount() const
Return the number of points in the shape poly set.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
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 Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the reference to aHole-th hole in the aIndex-th outline.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void BooleanIntersection(const SHAPE_POLY_SET &b)
Perform boolean polyset intersection.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
int OutlineCount() const
Return the number of outlines in the set.
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.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
Handle a list of polygons defining a copper zone.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
SHAPE_POLY_SET * Outline()
bool SetNetCode(int aNetCode, bool aNoAssert) override
Override that clamps the netcode to 0 when this zone is in copper-thieving fill mode.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
SHAPE_POLY_SET GetLibraryOutline() const
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the zone shape to a closed polygon Used in filling zones calculations Circles and arcs are ap...
unsigned GetAssignedPriority() const
This file is part of the common library.
bool ConvertOutlineToPolygon(std::vector< PCB_SHAPE * > &aShapeList, SHAPE_POLY_SET &aPolygons, int aErrorMax, int aChainingEpsilon, bool aAllowDisjoint, OUTLINE_ERROR_HANDLER *aErrorHandler, bool aAllowUseArcsInPolygons)
Build a polygon set with holes from a PCB_SHAPE list.
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
void BuildConvexHull(std::vector< VECTOR2I > &aResult, const std::vector< VECTOR2I > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.
@ CHAMFER_ACUTE_CORNERS
Acute angles are chamfered.
@ DRCE_DRILLED_HOLES_TOO_CLOSE
@ DRCE_DRILLED_HOLES_COLOCATED
@ HOLE_TO_HOLE_CONSTRAINT
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_180
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
#define COURTYARD_CONFLICT
temporary set when moving footprints having courtyard overlapping
#define MALFORMED_F_COURTYARD
#define MALFORMED_B_COURTYARD
#define STRUCT_DELETED
flag indication structures to be erased
#define MALFORMED_COURTYARDS
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
@ FRAME_FOOTPRINT_CHOOSER
a few functions useful in geometry calculations.
const wxChar *const traceApi
Flag to enable debug output related to the IPC API and its plugin system.
Some functions to handle hotkeys in KiCad.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
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.
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
PCB_LAYER_ID
A quick note on layer IDs:
bool IsValidLayer(int aLayerId)
Test whether a given integer is a valid layer index, i.e.
const wxString & GetLibFilenameForbiddenChars()
Characters illegal in a footprint library filename.
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.
@ LEFT_RIGHT
Flip left to right (around the Y axis)
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
DIFF_VALUE WxAnyToDiffValue(const wxAny &aValue, PROPERTY_BASE *aProperty)
Convert a wxAny value read from a PROPERTY_BASE getter into a DIFF_VALUE that the engine can store,...
bool BoxHitTest(const VECTOR2I &aHitPoint, const BOX2I &aHittee, int aAccuracy)
Perform a point-to-box hit test.
wxString GetRefDesPrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
void PackEmbeddedFiles(common::types::EmbeddedFiles &aOutput, const EMBEDDED_FILES &aFiles)
bool UnpackEmbeddedFiles(EMBEDDED_FILES &aOutput, const common::types::EmbeddedFiles &aProto)
KICOMMON_API KIID_PATH UnpackSheetPath(const types::SheetPath &aInput)
KICOMMON_API std::optional< KICAD_T > TypeNameFromAny(const google::protobuf::Any &aMessage)
KICOMMON_API VECTOR3D UnpackVector3D(const types::Vector3D &aInput)
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API void PackSheetPath(types::SheetPath &aOutput, const KIID_PATH &aInput)
KICOMMON_API void PackLibId(types::LibraryIdentifier *aOutput, const LIB_ID &aId)
KICOMMON_API LIB_ID UnpackLibId(const types::LibraryIdentifier &aId)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
KICOMMON_API void PackVector3D(types::Vector3D &aOutput, const VECTOR3D &aInput)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ SMD
Smd pad, appears on the solder paste layer (default)
@ PTH
Plated through hole pad.
@ FIDUCIAL_LOCAL
a fiducial (usually a smd) local to the parent footprint
@ FIDUCIAL_GLBL
a fiducial (usually a smd) for the full board
@ MECHANICAL
a pad used for mechanical support
@ PRESSFIT
a PTH with a hole diameter with tight tolerances for press fit pin
@ HEATSINK
a pad used as heat sink, usually in SMD footprints
@ NONE
no special fabrication property
@ TESTPOINT
a test point pad
@ CASTELLATED
a pad with a castellated through hole
@ BGA
Smd pad, used in BGA footprints.
BARCODE class definition.
Class to handle a set of BOARD_ITEMs.
#define NO_SETTER(owner, type)
#define ENUM_TO_WXANY(type)
Macro to define read-only fields (no setter method available)
@ PT_DEGREE
Angle expressed in degrees.
@ PT_SIZE
Size expressed in distance units (mm/inch)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Collection of utility functions for component reference designators (refdes)
std::vector< FAB_LAYER_COLOR > dummy
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString GetDefaultVariantName()
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
wxString UnescapeString(const wxString &aSource)
A structure for storing weighted search terms.
wxString GetDefaultFieldName(FIELD_T aFieldId, TRANSLATION aTranslation)
Return a default symbol field name for a mandatory field type.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ USER
The field ID hasn't been set yet; field is invalid.
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
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.
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_CONSTRAINT_T
a geometric constraint between board items
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ 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_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
VECTOR2< int32_t > VECTOR2I
ZONE_CONNECTION
How pads are covered by copper in zone.
@ THERMAL
Use thermal relief for pads.
@ THT_THERMAL
Thermal relief only for THT pads.
@ NONE
Pads are not covered.
@ FULL
pads are covered by copper