31 #include <unordered_set> 53 m_boundingBoxCacheTimeStamp( 0 ),
54 m_visibleBBoxCacheTimeStamp( 0 ),
55 m_textExcludedBBoxCacheTimeStamp( 0 ),
56 m_hullCacheTimeStamp( 0 ),
57 m_initial_comments( nullptr )
114 std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
128 PAD* newPad = static_cast<PAD*>(
pad->Clone() );
129 ptrMap[
pad ] = newPad;
136 FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
137 ptrMap[ zone ] = newZone;
150 BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
151 ptrMap[ item ] = newItem;
159 ptrMap[
group ] = newGroup;
172 if( ptrMap.count( member ) )
173 newGroup->
AddItem( ptrMap[ member ] );
194 *
this = std::move( aFootprint );
230 std::vector< BOARD_ITEM* > item_list;
233 item_list.push_back(
m_value );
236 item_list.push_back(
pad );
239 item_list.push_back( gr_item );
244 item_list.push_back(
group );
248 item_list.push_back( zone );
250 bool changed =
false;
256 const_cast<KIID&>( item->m_Uuid ) =
KIID();
269 m_pos = aOther.m_pos;
307 for(
PAD*
pad : aOther.Pads() )
310 aOther.Pads().clear();
315 for(
FP_ZONE* item : aOther.Zones() )
323 item->SetNetCode( -1 );
326 aOther.Zones().clear();
331 for(
BOARD_ITEM* item : aOther.GraphicalItems() )
334 aOther.GraphicalItems().clear();
342 aOther.Groups().clear();
347 m_doc = aOther.m_doc;
354 aOther.Pads().clear();
355 aOther.Zones().clear();
356 aOther.GraphicalItems().clear();
357 aOther.m_value =
nullptr;
358 aOther.m_reference =
nullptr;
359 aOther.m_initial_comments =
nullptr;
403 std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
411 ptrMap[
pad ] = newPad;
420 FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
421 ptrMap[ zone ] = newZone;
436 BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
437 ptrMap[ item ] = newItem;
450 newGroup->
AddItem( ptrMap[ member ] );
471 aVars->push_back( wxT(
"REFERENCE" ) );
472 aVars->push_back( wxT(
"VALUE" ) );
473 aVars->push_back( wxT(
"LAYER" ) );
479 if( token->IsSameAs( wxT(
"REFERENCE" ) ) )
484 else if( token->IsSameAs( wxT(
"VALUE" ) ) )
489 else if( token->IsSameAs( wxT(
"LAYER" ) ) )
515 switch( aBoardItem->
Type() )
531 m_pads.push_back( static_cast<PAD*>( aBoardItem ) );
533 m_pads.push_front( static_cast<PAD*>( aBoardItem ) );
538 m_fp_zones.push_back( static_cast<FP_ZONE*>( aBoardItem ) );
545 m_fp_groups.push_back( static_cast<PCB_GROUP*>( aBoardItem ) );
553 msg.Printf( wxT(
"FOOTPRINT::Add() needs work: BOARD_ITEM type (%d) not handled" ),
554 aBoardItem->
Type() );
568 switch( aBoardItem->
Type() )
574 wxT(
"Please report this bug: Invalid remove operation on required text" ) );
580 if( *it == aBoardItem )
590 for(
auto it =
m_pads.begin(); it !=
m_pads.end(); ++it )
592 if( *it == static_cast<PAD*>( aBoardItem ) )
604 if( *it == static_cast<FP_ZONE*>( aBoardItem ) )
616 if( *it == static_cast<PCB_GROUP*>( aBoardItem ) )
628 msg.Printf( wxT(
"FOOTPRINT::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
629 aBoardItem->
Type() );
647 double w = std::abs( static_cast<double>( bbox.
GetWidth() ) ) + aPadding;
648 double h = std::abs( static_cast<double>( bbox.
GetHeight() ) ) + aPadding;
660 switch(
pad->GetProperty() )
676 switch(
pad->GetAttribute() )
707 return _(
"Through hole" );
723 if(
dummy.IsFlipped() )
724 dummy.Flip( wxPoint( 0, 0 ) ,
false );
726 if(
dummy.GetOrientation() )
727 dummy.SetOrientation( 0 );
730 area.
Merge(
pad->GetBoundingBox() );
748 if( aIncludeText && aIncludeInvisibleText )
753 else if( aIncludeText )
774 area.
Merge( item->GetBoundingBox() );
778 area.
Merge(
pad->GetBoundingBox() );
781 area.
Merge( zone->GetBoundingBox() );
786 if( aIncludeText || noDrawItems )
791 area.
Merge( item->GetBoundingBox() );
796 bool valueLayerIsVisible =
true;
797 bool refLayerIsVisible =
true;
816 || aIncludeInvisibleText || noDrawItems )
820 || aIncludeInvisibleText || noDrawItems )
826 if( ( aIncludeText && aIncludeInvisibleText ) || noDrawItems )
831 else if( aIncludeText )
864 item->TransformShapeWithClearanceToPolygon( rawPolys,
UNDEFINED_LAYER, 0, ARC_LOW_DEF,
876 pad->TransformHoleWithClearanceToPolygon( rawPolys, 0, ARC_LOW_DEF,
ERROR_OUTSIDE );
910 std::vector<wxPoint> convex_hull;
916 for(
const wxPoint& pt : convex_hull )
940 msg = date.Format( wxT(
"%b %d, %Y" ) );
942 msg =
_(
"Unknown" );
944 aList.emplace_back(
_(
"Last Change" ), msg );
948 aList.emplace_back(
_(
"Board Side" ),
IsFlipped() ?
_(
"Back (Flipped)" ) :
_(
"Front" ) );
951 auto addToken = []( wxString* aStr,
const wxString& aAttr )
953 if( !aStr->IsEmpty() )
954 *aStr += wxT(
", " );
963 addToken( &status,
_(
"Locked" ) );
966 addToken( &status,
_(
"autoplaced" ) );
969 addToken( &attrs,
_(
"not in schematic" ) );
972 addToken( &attrs,
_(
"exclude from pos files" ) );
975 addToken( &attrs,
_(
"exclude from BOM" ) );
977 aList.emplace_back(
_(
"Status: " ) + status,
_(
"Attributes:" ) + wxS(
" " ) + attrs );
983 msg2.Printf(
_(
"3D-Shape: %s" ),
m_3D_Drawings.empty() ?
_(
"<none>" )
985 aList.emplace_back( msg, msg2 );
987 msg.Printf(
_(
"Doc: %s" ),
m_doc );
989 aList.emplace_back( msg, msg2 );
1002 if( !zone->IsOnLayer( aLayer ) )
1008 if( !item->IsOnLayer( aLayer ) )
1051 if(
pad->HitTest( arect,
false, 0 ) )
1057 if( zone->HitTest( arect,
false, 0 ) )
1063 if( item->Type() !=
PCB_FP_TEXT_T && item->HitTest( arect,
false, 0 ) )
1077 bool can_select = aSearchAfterMe ? false :
true;
1081 if( !can_select &&
pad == aSearchAfterMe )
1087 if( can_select &&
pad->GetNumber() == aPadNumber )
1100 if( !(
pad->GetLayerSet() & aLayerMask ).any() )
1103 if(
pad->HitTest( aPosition ) )
1117 wxPoint pnt = p->GetPosition();
1151 std::set<wxString> usedNumbers;
1163 if(
pad->GetNumber().IsEmpty() )
1173 usedNumbers.insert(
pad->GetNumber() );
1176 return usedNumbers.size();
1182 if(
nullptr == a3DModel )
1198 #if 0 && defined(DEBUG) 1199 std::cout <<
GetClass().mb_str() <<
' ';
1209 result = inspector(
this, testData );
1214 result = IterateForward<PAD*>(
m_pads, inspector, testData, p );
1219 result = IterateForward<FP_ZONE*>(
m_fp_zones, inspector, testData, p );
1229 result = inspector(
m_value, testData );
1238 result = IterateForward<BOARD_ITEM*>(
m_drawings, inspector, testData, p );
1243 switch( stype = *++p )
1259 result = IterateForward<PCB_GROUP*>(
m_fp_groups, inspector, testData, p );
1280 if( reference.IsEmpty() )
1281 reference =
_(
"<no reference designator>" );
1304 aFunction( static_cast<BOARD_ITEM*>(
pad ) );
1307 aFunction( static_cast<FP_ZONE*>( zone ) );
1310 aFunction( static_cast<PCB_GROUP*>(
group ) );
1313 aFunction( static_cast<BOARD_ITEM*>( drawing ) );
1315 aFunction( static_cast<BOARD_ITEM*>(
m_reference ) );
1316 aFunction( static_cast<BOARD_ITEM*>(
m_value ) );
1318 catch( std::bad_function_call& )
1320 wxFAIL_MSG( wxT(
"Error running FOOTPRINT::RunOnChildren" ) );
1327 std::unordered_set<int> layers;
1330 layers.insert( static_cast<int>( item->GetLayer() ) );
1337 pad->ViewGetLayers( pad_layers, pad_layers_count );
1339 for(
int i = 0; i < pad_layers_count; i++ )
1340 layers.insert( pad_layers[i] );
1344 aCount = layers.size();
1347 for(
int layer : layers )
1348 aLayers[i++] = layer;
1360 wxASSERT_MSG(
false, wxT(
"Illegal layer" ) );
1375 bool f_silk =
false, b_silk =
false, non_silk =
false;
1379 if( item->GetLayer() ==
F_SilkS )
1381 else if( item->GetLayer() ==
B_SilkS )
1387 if( ( f_silk || b_silk ) && !non_silk &&
m_pads.empty() )
1390 aLayers[ aCount++ ] =
F_SilkS;
1393 aLayers[ aCount++ ] =
B_SilkS;
1406 #define MINIMAL_ZOOM_LEVEL_FOR_VISIBILITY 1.5 1411 return std::numeric_limits<double>::max();
1426 area.
Inflate( biggest_clearance );
1437 if( aName.find_first_of( invalids ) != std::string::npos )
1449 static const wxChar invalidChars[] = wxT(
"%$<>\t\n\r\"\\/:");
1450 static const wxChar invalidCharsReadable[] = wxT(
"% $ < > 'tab' 'return' 'line feed' \\ \" / :");
1453 return invalidCharsReadable;
1455 return invalidChars;
1461 wxPoint newpos =
m_pos + aMoveVector;
1469 double newOrientation = orientation + aAngle;
1470 wxPoint newpos =
m_pos;
1481 static_cast<FP_TEXT*>( item )->KeepUpright( orientation, newOrientation );
1494 wxPoint finalPos =
m_pos;
1505 MIRROR( finalPos.y, aCentre.y );
1523 zone->Flip(
m_pos,
false );
1532 switch( item->Type() )
1535 static_cast<FP_SHAPE*>( item )->Flip(
m_pos,
false );
1539 static_cast<FP_TEXT*>( item )->Flip(
m_pos,
false );
1543 wxMessageBox( wxT(
"FOOTPRINT::Flip() error: Unknown Draw Type" ) );
1549 if( aFlipLeftRight )
1550 Rotate( aCentre, 1800.0 );
1575 zone->Move(
delta );
1579 switch( item->Type() )
1583 FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
1596 wxMessageBox( wxT(
"Draw type undefined." ) );
1620 wxPoint moveVector = aMoveVector;
1632 pad->SetPos0(
pad->GetPos0() + moveVector );
1633 pad->SetDrawCoord();
1639 switch( item->Type() )
1643 FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
1644 shape->
Move( moveVector );
1651 text->SetPos0(
text->GetPos0() + moveVector );
1652 text->SetDrawCoord();
1664 zone->Move( moveVector );
1670 model.m_Offset.x += Iu2Millimeter( moveVector.x );
1671 model.m_Offset.y -= Iu2Millimeter( moveVector.y );
1683 double angleChange = aNewAngle -
m_orient;
1691 pad->SetOrientation(
pad->GetOrientation() + angleChange );
1692 pad->SetDrawCoord();
1709 static_cast<FP_SHAPE*>( item )->SetDrawCoord();
1713 static_cast<FP_TEXT*>( item )->SetDrawCoord();
1743 switch( aItem->
Type() )
1747 PAD* new_pad =
new PAD( *static_cast<const PAD*>( aItem ) );
1748 const_cast<KIID&>( new_pad->
m_Uuid ) =
KIID();
1750 if( aAddToFootprint )
1751 m_pads.push_back( new_pad );
1759 new_zone =
new FP_ZONE( *static_cast<const FP_ZONE*>( aItem ) );
1760 const_cast<KIID&>( new_zone->
m_Uuid ) =
KIID();
1762 if( aAddToFootprint )
1765 new_item = new_zone;
1771 FP_TEXT* new_text =
new FP_TEXT( *static_cast<const FP_TEXT*>( aItem ) );
1772 const_cast<KIID&>( new_text->
m_Uuid ) =
KIID();
1776 new_text->
SetText( wxT(
"${REFERENCE}" ) );
1781 new_text->
SetText( wxT(
"${VALUE}" ) );
1785 if( aAddToFootprint )
1788 new_item = new_text;
1795 FP_SHAPE* new_shape =
new FP_SHAPE( *static_cast<const FP_SHAPE*>( aItem ) );
1796 const_cast<KIID&>( new_shape->
m_Uuid ) =
KIID();
1798 if( aAddToFootprint )
1801 new_item = new_shape;
1806 new_item = static_cast<const PCB_GROUP*>( aItem )->DeepDuplicate();
1815 wxFAIL_MSG( wxT(
"Duplication not supported for items of class " ) + aItem->
GetClass() );
1825 std::set<wxString> usedNumbers;
1829 usedNumbers.insert(
pad->GetNumber() );
1836 while( usedNumbers.count(
wxString::Format( wxT(
"%s%d" ), prefix, num ) ) )
1862 for(
int jj = 0; jj < aPolySet.
HoleCount( ii ); jj++ )
1866 return aPolySet.
Area();
1877 const PCB_MARKER* marker = static_cast<const PCB_MARKER*>( aItem );
1881 return markerShape.
Area();
1885 double combinedArea = 0.0;
1887 for(
BOARD_ITEM* member : static_cast<const PCB_GROUP*>( aItem )->GetItems() )
1890 return combinedArea;
1894 const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( aItem );
1900 const FP_TEXT*
text = static_cast<const FP_TEXT*>( aItem );
1911 const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aItem );
1937 double width = static_cast<const PCB_TRACK*>( aItem )->GetWidth();
1938 return width * width;
1965 for(
int i = 0; i < aCollector.
GetCount(); ++i )
1969 switch( item->
Type() )
1992 const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( item );
2002 double footprintRegionArea =
polygonArea( footprintRegion );
2003 double uncoveredRegionArea = footprintRegionArea -
polygonArea( coveredRegion );
2004 double coveredArea = footprintRegionArea - uncoveredRegionArea;
2005 double ratio = ( coveredArea / footprintRegionArea );
2012 return std::min( ratio, 1.0 );
2018 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
2028 shape->AddShape(
pad->GetEffectiveShape( aLayer, aFlash )->Clone() );
2033 shape->AddShape( item->GetEffectiveShape( aLayer, aFlash )->Clone() );
2049 std::vector<PCB_SHAPE*> list_front;
2050 std::vector<PCB_SHAPE*> list_back;
2055 list_back.push_back( static_cast<PCB_SHAPE*>( item ) );
2058 list_front.push_back( static_cast<PCB_SHAPE*>( item ) );
2061 if( !list_front.size() && !list_back.size() )
2103 if( aErrorHandler && likelyAttr != setAttr )
2109 msg.Printf(
_(
"Expected \"Through hole\" type but set to \"%s\"" ),
GetTypeName() );
2111 else if( likelyAttr ==
FP_SMD )
2113 msg.Printf(
_(
"Expected \"SMD\" type but set to \"%s\"" ),
GetTypeName() );
2117 msg.Printf(
_(
"Expected \"Other\" type but set to \"%s\"" ),
GetTypeName() );
2120 msg = wxT(
"(" ) + msg + wxT(
")" );
2122 (*aErrorHandler)( msg );
2127 const std::function<
void(
const wxString& msg,
const wxPoint& position )>*
2130 if( aErrorHandler ==
nullptr )
2140 if(
pad->GetDrillSizeX() < 1 ||
pad->GetDrillSizeY() < 1 )
2143 msg.Printf(
_(
"(pad \"%s\")" ),
pad->GetNumber() );
2145 (*aErrorHandler)( msg,
pad->GetPosition() );
2174 if( aFirst->
Type() != aSecond->
Type() )
2175 return aFirst->
Type() < aSecond->
Type();
2182 const FP_SHAPE* dwgA = static_cast<const FP_SHAPE*>( aFirst );
2183 const FP_SHAPE* dwgB = static_cast<const FP_SHAPE*>( aSecond );
2192 return aFirst < aSecond;
2204 return aFirst < aSecond;
2211 bool aSkipNPTHPadsWihNoCopper,
2212 bool aSkipPlatedPads,
2213 bool aSkipNonPlatedPads )
const 2217 if( !
pad->FlashLayer( aLayer ) )
2220 wxSize clearance( aClearance, aClearance );
2225 if( aSkipPlatedPads &&
pad->FlashLayer(
F_Mask ) )
2228 if( aSkipNonPlatedPads && !
pad->FlashLayer(
F_Mask ) )
2234 if( aSkipPlatedPads &&
pad->FlashLayer(
B_Mask ) )
2237 if( aSkipNonPlatedPads && !
pad->FlashLayer(
B_Mask ) )
2244 clearance.x +=
pad->GetSolderMaskMargin();
2245 clearance.y +=
pad->GetSolderMaskMargin();
2250 clearance +=
pad->GetSolderPasteMargin();
2264 if( ( clearance.x < 0 || clearance.x != clearance.y )
2267 wxSize dummySize =
pad->GetSize() + clearance + clearance;
2269 if( dummySize.x <= 0 || dummySize.y <= 0 )
2273 dummy.SetSize( dummySize );
2274 dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, 0,
2275 aMaxError, aErrorLoc );
2279 pad->TransformShapeWithClearanceToPolygon( aCornerBuffer, aLayer, clearance.x,
2280 aMaxError, aErrorLoc );
2290 bool aIncludeShapes )
const 2292 std::vector<FP_TEXT*> texts;
2301 texts.push_back(
text );
2306 const FP_SHAPE* outline = static_cast<FP_SHAPE*>( item );
2311 aError, aErrorLoc );
2322 texts.push_back( &
Value() );
2327 text->TransformTextShapeWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance,
2328 aError, aErrorLoc );
2339 if( layerEnum.
Choices().GetCount() == 0 )
2347 wxPGChoices fpLayers;
2360 layer->SetChoices( fpLayers );
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Display value expressed in degrees.
PCB_GROUP * GetParentGroup() const
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
void KeepUpright(double aOldOrientation, double aNewOrientation)
Called when rotating the parent footprint.
static PROPERTY_MANAGER & Instance()
void Move(const wxPoint &aMoveVector)
Move the rectangle by the aMoveVector.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
class FP_TEXT, text in a footprint
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
#define MALFORMED_B_COURTYARD
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
This file is part of the common library.
virtual void SetPosition(const wxPoint &aPos)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
class PCB_GROUP, a set of BOARD_ITEMs
show footprints values (when texts are visible)
A set of BOARD_ITEMs (i.e., without duplicates).
virtual double OnePixelInIU() const =0
ENUM_MAP & Undefined(T aValue)
#define MALFORMED_F_COURTYARD
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Smd pad, appears on the solder paste layer (default)
Collection of utility functions for component reference designators (refdes)
static ENUM_MAP< T > & Instance()
void SetFlags(EDA_ITEM_FLAGS aMask)
class PCB_TEXT, text on a layer
anchor of items having an anchor point (texts, footprints)
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
class PCB_ARC, an arc track segment on a copper layer
void SetDrawCoord()
Set relative coordinates.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
void SetOrigin(const wxPoint &pos)
double Area()
Count the number of arc shapes present.
class FP_SHAPE, a footprint edge
class PAD, a pad in a footprint
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
double Area(bool aAbsolute=true) const
Return the area of this chain.
void NORMALIZE_ANGLE_180(T &Angle)
void RotatePoint(int *pX, int *pY, double angle)
The base class for create windows for drawing purpose.
void SetType(TEXT_TYPE aType)
std::unordered_set< BOARD_ITEM * > & GetItems()
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
bool Contains(const wxPoint &aPoint) const
const INSPECTOR_FUNC & INSPECTOR
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
virtual void SetParent(EDA_ITEM *aParent)
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
class PCB_TRACK, a track segment (segment on a copper layer)
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
This file contains miscellaneous commonly used macros and functions.
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
a pad used as heat sink, usually in SMD footprints
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
int GetCount() const
Return the number of objects in the list.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
like PAD_PTH, but not plated
Display value expressed in distance units (mm/inch)
const COLLECTORS_GUIDE * GetGuide() const
LSET is a set of PCB_LAYER_IDs.
virtual void SetText(const wxString &aText)
void Move(const VECTOR2I &aVector) override
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip entity during footprint flip.
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
TEXT_TYPE GetType() const
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
virtual bool IsVisible() const
void SetEnd(int x, int y)
Smd pad, used in BGA footprints.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
const wxString & GetNumber() const
a fiducial (usually a smd) local to the parent footprint
#define STRUCT_DELETED
flag indication structures to be erased
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
static LSET AllLayersMask()
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
Handle a list of polygons defining a copper zone.
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
int NewOutline()
Creates a new hole in a given outline.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
Acute angles are chamfered.
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
void SetPos0(const wxPoint &aPos)
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
static const int ORPHANED
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
EDA_ITEM_FLAGS GetFlags() const
class FOOTPRINT, a footprint
void Inflate(int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Some functions to handle hotkeys in KiCad.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
wxString m_Filename
The 3D shape filename in 3D library.
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...
const wxPoint & GetPos0() const
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
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,...
show footprints references (when texts are visible)
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
const EDA_RECT GetBoundingBox() const override
Set absolute coordinates.
class PCB_MARKER, a marker used to show something
virtual wxString GetClass() const =0
Return the class name.
bool IsType(FRAME_T aType) const
a fiducial (usually a smd) for the full board
BITMAPS
A list of all bitmap identifiers.
wxPoint GetPosition() const override
no special fabrication property
Information pertinent to a Pcbnew printed circuit board.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
PCB_LAYER_ID
A quick note on layer IDs:
Used when the right click button is pressed, or when the select tool is in effect.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
void AddProperty(PROPERTY_BASE *aProperty)
Register a property.
class ZONE, managed by a footprint
int GetBiggestClearanceValue() const
Handle the component boundary box.
double DECIDEG2RAD(double deg)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
A base class for most all the KiCad significant classes used in schematics and boards.
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
wxString GetRefDesPrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
void ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew)
Replace an existing property for a specific type.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Provide class metadata.Helper macro to map type hashes to names.
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const wxPoint &pt)> OUTLINE_ERROR_HANDLER
a pad with a castellated through hole
void CacheTriangulation(bool aPartition=true)
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
class PCB_VIA, a via (like a track segment on a copper layer)
void Move(const wxPoint &aMoveVector) override
Move an edge of the footprint.
virtual void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
#define PCB_EDIT_FRAME_NAME
wxString GetUniStringLibId() const
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
bool ConvertOutlineToPolygon(std::vector< PCB_SHAPE * > &aSegList, SHAPE_POLY_SET &aPolygons, int aErrorMax, int aChainingEpsilon, OUTLINE_ERROR_HANDLER *aErrorHandler)
Function ConvertOutlineToPolygon Build a polygon (with holes) from a PCB_SHAPE list,...
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
ENUM_MAP & Map(T aValue, const wxString &aName)
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
BOARD_ITEM_CONTAINER * GetParent() const
#define MALFORMED_COURTYARDS
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
class PCB_SHAPE, a segment not on copper layers
static constexpr int Millimeter2iu(double mm)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
A specialization of ZONE for use in footprints.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
KICAD_T Type() const
Returns the type of object.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
void BuildConvexHull(std::vector< wxPoint > &aResult, const std::vector< wxPoint > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.