31 #include <unordered_set> 48 m_boundingBoxCacheTimeStamp( 0 ),
49 m_visibleBBoxCacheTimeStamp( 0 ),
50 m_textExcludedBBoxCacheTimeStamp( 0 ),
51 m_hullCacheTimeStamp( 0 ),
52 m_initial_comments( 0 )
109 std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
121 for(
PAD* pad : aFootprint.
Pads() )
123 PAD* newPad = static_cast<PAD*>( pad->Clone() );
124 ptrMap[ pad ] = newPad;
131 FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
132 ptrMap[ zone ] = newZone;
145 BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
146 ptrMap[ item ] = newItem;
153 PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
154 ptrMap[ group ] = newGroup;
161 PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( ptrMap[ group ] );
166 newGroup->
AddItem( ptrMap[ member ] );
186 *
this = std::move( aFootprint );
223 m_pos = aOther.m_pos;
261 for(
PAD* pad : aOther.Pads() )
264 aOther.Pads().clear();
269 for(
FP_ZONE* item : aOther.Zones() )
277 item->SetNetCode( -1 );
280 aOther.Zones().clear();
285 for(
BOARD_ITEM* item : aOther.GraphicalItems() )
288 aOther.GraphicalItems().clear();
293 for(
PCB_GROUP* group : aOther.Groups() )
296 aOther.Groups().clear();
301 m_doc = aOther.m_doc;
308 aOther.Pads().clear();
309 aOther.Zones().clear();
310 aOther.GraphicalItems().clear();
311 aOther.m_value =
nullptr;
312 aOther.m_reference =
nullptr;
313 aOther.m_initial_comments =
nullptr;
357 std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
362 for(
PAD* pad : aOther.
Pads() )
364 PAD* newPad =
new PAD( *pad );
365 ptrMap[ pad ] = newPad;
374 FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
375 ptrMap[ zone ] = newZone;
390 BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
391 ptrMap[ item ] = newItem;
400 PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
401 const_cast<std::unordered_set<BOARD_ITEM*>*
>( &newGroup->
GetItems() )->clear();
404 newGroup->
AddItem( ptrMap[ member ] );
425 aVars->push_back( wxT(
"REFERENCE" ) );
426 aVars->push_back( wxT(
"VALUE" ) );
427 aVars->push_back( wxT(
"LAYER" ) );
433 if( token->IsSameAs( wxT(
"REFERENCE" ) ) )
438 else if( token->IsSameAs( wxT(
"VALUE" ) ) )
443 else if( token->IsSameAs( wxT(
"LAYER" ) ) )
469 switch( aBoardItem->
Type() )
485 m_pads.push_back( static_cast<PAD*>( aBoardItem ) );
487 m_pads.push_front( static_cast<PAD*>( aBoardItem ) );
492 m_fp_zones.push_back( static_cast<FP_ZONE*>( aBoardItem ) );
499 m_fp_groups.push_back( static_cast<PCB_GROUP*>( aBoardItem ) );
507 msg.Printf( wxT(
"FOOTPRINT::Add() needs work: BOARD_ITEM type (%d) not handled" ),
508 aBoardItem->
Type() );
522 switch( aBoardItem->
Type() )
528 "Please report this bug: Invalid remove operation on required text" );
534 if( *it == aBoardItem )
544 for(
auto it =
m_pads.begin(); it !=
m_pads.end(); ++it )
546 if( *it == static_cast<PAD*>( aBoardItem ) )
558 if( *it == static_cast<FP_ZONE*>( aBoardItem ) )
570 if( *it == static_cast<PCB_GROUP*>( aBoardItem ) )
582 msg.Printf( wxT(
"FOOTPRINT::Remove() needs work: BOARD_ITEM type (%d) not handled" ),
583 aBoardItem->
Type() );
601 double w = std::abs( static_cast<double>( bbox.
GetWidth() ) ) + aPadding;
602 double h = std::abs( static_cast<double>( bbox.
GetHeight() ) ) + aPadding;
617 if(
dummy.IsFlipped() )
618 dummy.Flip( wxPoint( 0, 0 ) ,
false );
620 if(
dummy.GetOrientation() )
621 dummy.SetOrientation( 0 );
624 area.
Merge( pad->GetBoundingBox() );
642 if( aIncludeText && aIncludeInvisibleText )
647 else if( aIncludeText )
668 area.
Merge( item->GetBoundingBox() );
672 area.
Merge( pad->GetBoundingBox() );
675 area.
Merge( zone->GetBoundingBox() );
684 area.
Merge( item->GetBoundingBox() );
689 bool valueLayerIsVisible =
true;
690 bool refLayerIsVisible =
true;
708 if( (
m_value->
IsVisible() && valueLayerIsVisible ) || aIncludeInvisibleText )
717 if( aIncludeText && aIncludeInvisibleText )
722 else if( aIncludeText )
755 item->TransformShapeWithClearanceToPolygon( rawPolys,
UNDEFINED_LAYER, 0, ARC_LOW_DEF,
764 pad->TransformShapeWithClearanceToPolygon( rawPolys,
UNDEFINED_LAYER, 0, ARC_LOW_DEF,
798 std::vector<wxPoint> convex_hull;
804 for(
const wxPoint& pt : convex_hull )
828 msg = date.Format( wxT(
"%b %d, %Y" ) );
830 msg =
_(
"Unknown" );
832 aList.emplace_back(
_(
"Last Change" ), msg );
836 aList.emplace_back(
_(
"Board Side" ),
IsFlipped() ?
_(
"Back (Flipped)" ) :
_(
"Front" ) );
839 auto addToken = []( wxString* aStr,
const wxString& aAttr )
841 if( !aStr->IsEmpty() )
842 *aStr += wxT(
", " );
851 addToken( &status,
_(
"locked" ) );
854 addToken( &status,
_(
"autoplaced" ) );
857 addToken( &attrs,
_(
"not in schematic" ) );
860 addToken( &attrs,
_(
"exclude from pos files" ) );
863 addToken( &attrs,
_(
"exclude from BOM" ) );
865 aList.emplace_back(
_(
"Status: " ) + status,
_(
"Attributes:" ) + wxS(
" " ) + attrs );
870 msg2.Printf(
_(
"3D-Shape: %s" ),
m_3D_Drawings.empty() ?
_(
"<none>" )
872 aList.emplace_back( msg, msg2 );
874 msg.Printf(
_(
"Doc: %s" ),
m_doc );
876 aList.emplace_back( msg, msg2 );
889 if( !zone->IsOnLayer( aLayer ) )
895 if( !item->IsOnLayer( aLayer ) )
932 if( pad->HitTest( arect,
false, 0 ) )
938 if( zone->HitTest( arect,
false, 0 ) )
944 if( item->Type() !=
PCB_FP_TEXT_T && item->HitTest( arect,
false, 0 ) )
960 if( pad->GetName() == aPadName )
973 if( !( pad->GetLayerSet() & aLayerMask ).any() )
976 if( pad->HitTest( aPosition ) )
990 wxPoint pnt = p->GetPosition();
1024 std::set<wxString> usedNames;
1036 if( pad->GetName().IsEmpty() )
1048 usedNames.insert( pad->GetName() );
1051 return usedNames.size();
1057 if(
nullptr == a3DModel )
1073 #if 0 && defined(DEBUG) 1074 std::cout <<
GetClass().mb_str() <<
' ';
1084 result = inspector(
this, testData );
1089 result = IterateForward<PAD*>(
m_pads, inspector, testData, p );
1094 result = IterateForward<FP_ZONE*>(
m_fp_zones, inspector, testData, p );
1104 result = inspector(
m_value, testData );
1113 result = IterateForward<BOARD_ITEM*>(
m_drawings, inspector, testData, p );
1118 switch( stype = *++p )
1134 result = IterateForward<PCB_GROUP*>(
m_fp_groups, inspector, testData, p );
1155 if( reference.IsEmpty() )
1156 reference =
_(
"<no reference designator>" );
1179 aFunction( static_cast<BOARD_ITEM*>( pad ) );
1182 aFunction( static_cast<FP_ZONE*>( zone ) );
1185 aFunction( static_cast<PCB_GROUP*>( group ) );
1188 aFunction( static_cast<BOARD_ITEM*>( drawing ) );
1190 aFunction( static_cast<BOARD_ITEM*>(
m_reference ) );
1191 aFunction( static_cast<BOARD_ITEM*>(
m_value ) );
1193 catch( std::bad_function_call& )
1195 wxFAIL_MSG(
"Error running FOOTPRINT::RunOnChildren" );
1202 std::unordered_set<int> layers;
1205 layers.insert( static_cast<int>( item->GetLayer() ) );
1212 pad->ViewGetLayers( pad_layers, pad_layers_count );
1214 for(
int i = 0; i < pad_layers_count; i++ )
1215 layers.insert( pad_layers[i] );
1219 aCount = layers.size();
1222 for(
int layer : layers )
1223 aLayers[i++] = layer;
1235 wxASSERT_MSG(
false,
"Illegal layer" );
1250 bool f_silk =
false, b_silk =
false, non_silk =
false;
1254 if( item->GetLayer() ==
F_SilkS )
1256 else if( item->GetLayer() ==
B_SilkS )
1262 if( ( f_silk || b_silk ) && !non_silk &&
m_pads.empty() )
1265 aLayers[ aCount++ ] =
F_SilkS;
1268 aLayers[ aCount++ ] =
B_SilkS;
1281 #define MINIMAL_ZOOM_LEVEL_FOR_VISIBILITY 1.5 1286 return std::numeric_limits<double>::max();
1301 area.
Inflate( biggest_clearance );
1312 if( aName.find_first_of( invalids ) != std::string::npos )
1324 static const wxChar invalidChars[] = wxT(
"%$<>\t\n\r\"\\/:");
1325 static const wxChar invalidCharsReadable[] = wxT(
"% $ < > 'tab' 'return' 'line feed' \\ \" / :");
1328 return invalidCharsReadable;
1330 return invalidChars;
1336 wxPoint newpos =
m_pos + aMoveVector;
1344 double newOrientation = orientation + aAngle;
1345 wxPoint newpos =
m_pos;
1356 static_cast<FP_TEXT*>( item )->KeepUpright( orientation, newOrientation );
1369 wxPoint finalPos =
m_pos;
1380 MIRROR( finalPos.y, aCentre.y );
1394 pad->Flip(
m_pos,
false );
1398 zone->Flip(
m_pos,
false );
1407 switch( item->Type() )
1410 static_cast<FP_SHAPE*>( item )->Flip(
m_pos,
false );
1414 static_cast<FP_TEXT*>( item )->Flip(
m_pos,
false );
1418 wxMessageBox( wxT(
"FOOTPRINT::Flip() error: Unknown Draw Type" ) );
1424 if( aFlipLeftRight )
1425 Rotate( aCentre, 1800.0 );
1439 wxPoint delta = aPos -
m_pos;
1444 m_value->EDA_TEXT::Offset( delta );
1450 zone->Move( delta );
1454 switch( item->Type() )
1458 FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
1465 FP_TEXT* text = static_cast<FP_TEXT*>( item );
1466 text->EDA_TEXT::Offset( delta );
1471 wxMessageBox( wxT(
"Draw type undefined." ) );
1495 wxPoint moveVector = aMoveVector;
1507 pad->SetPos0( pad->GetPos0() + moveVector );
1508 pad->SetDrawCoord();
1514 switch( item->Type() )
1518 FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
1519 shape->
Move( moveVector );
1525 FP_TEXT* text = static_cast<FP_TEXT*>( item );
1539 zone->Move( moveVector );
1551 double angleChange = aNewAngle -
m_orient;
1559 pad->SetOrientation( pad->GetOrientation() + angleChange );
1560 pad->SetDrawCoord();
1577 static_cast<FP_SHAPE*>( item )->SetDrawCoord();
1581 static_cast<FP_TEXT*>( item )->SetDrawCoord();
1603 return static_cast<BOARD_ITEM*>( dupe );
1612 switch( aItem->
Type() )
1616 PAD* new_pad =
new PAD( *static_cast<const PAD*>( aItem ) );
1617 const_cast<KIID&>( new_pad->
m_Uuid ) =
KIID();
1619 if( aAddToFootprint )
1620 m_pads.push_back( new_pad );
1628 new_zone =
new FP_ZONE( *static_cast<const FP_ZONE*>( aItem ) );
1629 const_cast<KIID&>( new_zone->
m_Uuid ) =
KIID();
1631 if( aAddToFootprint )
1634 new_item = new_zone;
1640 FP_TEXT* new_text =
new FP_TEXT( *static_cast<const FP_TEXT*>( aItem ) );
1641 const_cast<KIID&>( new_text->
m_Uuid ) =
KIID();
1645 new_text->
SetText( wxT(
"${REFERENCE}" ) );
1650 new_text->
SetText( wxT(
"${VALUE}" ) );
1654 if( aAddToFootprint )
1657 new_item = new_text;
1664 FP_SHAPE* new_shape =
new FP_SHAPE( *static_cast<const FP_SHAPE*>( aItem ) );
1665 const_cast<KIID&>( new_shape->
m_Uuid ) =
KIID();
1667 if( aAddToFootprint )
1670 new_item = new_shape;
1675 new_item = static_cast<const PCB_GROUP*>( aItem )->DeepDuplicate();
1684 wxFAIL_MSG(
"Duplication not supported for items of class " + aItem->
GetClass() );
1694 std::set<wxString> usedNames;
1698 usedNames.insert( pad->GetName() );
1732 area += outline.
Area();
1746 const PCB_MARKER* marker = static_cast<const PCB_MARKER*>( aItem );
1750 return markerShape.
Area();
1754 double combinedArea = 0.0;
1756 for(
BOARD_ITEM* member : static_cast<const PCB_GROUP*>( aItem )->GetItems() )
1759 return combinedArea;
1764 const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( aItem );
1770 const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
1802 for(
int i = 0; i < aCollector.
GetCount(); ++i )
1806 switch( item->
Type() )
1829 const FOOTPRINT* footprint = static_cast<const FOOTPRINT*>( item );
1848 catch( ClipperLib::clipperException& )
1854 double footprintRegionArea =
polygonArea( footprintRegion );
1855 double uncoveredRegionArea =
polygonArea( uncoveredRegion );
1856 double coveredArea = footprintRegionArea - uncoveredRegionArea;
1857 double ratio = ( coveredArea / footprintRegionArea );
1859 return std::min( ratio, 1.0 );
1865 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
1875 shape->AddShape( pad->GetEffectiveShape( aLayer )->Clone() );
1880 shape->AddShape( item->GetEffectiveShape( aLayer )->Clone() );
1896 std::vector<PCB_SHAPE*> list_front;
1897 std::vector<PCB_SHAPE*> list_back;
1902 list_back.push_back( static_cast<PCB_SHAPE*>( item ) );
1905 list_front.push_back( static_cast<PCB_SHAPE*>( item ) );
1908 if( !list_front.size() && !list_back.size() )
1959 if( aFirst->
Type() != aSecond->
Type() )
1960 return aFirst->
Type() < aSecond->
Type();
1967 const FP_SHAPE* dwgA = static_cast<const FP_SHAPE*>( aFirst );
1968 const FP_SHAPE* dwgB = static_cast<const FP_SHAPE*>( aSecond );
1977 return aFirst < aSecond;
1989 return aFirst < aSecond;
1999 if( layerEnum.
Choices().GetCount() == 0 )
2007 wxPGChoices fpLayers;
2020 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 TransformTextShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc) const
Function TransformTextShapeWithClearanceToPolygon Convert the text to a polygonSet describing the act...
void Move(const wxPoint &aMoveVector)
Move the rectangle by the aMoveVector.
const BITMAP_OPAQUE module_xpm[1]
int OutlineCount() const
Return the number of vertices in a given outline/hole.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
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.
virtual void SetPosition(const wxPoint &aPos) override
PNG memory record (file in memory).
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
A set of BOARD_ITEMs (i.e., without duplicates).
virtual double OnePixelInIU() const =0
anchor of items having an anchor point (texts, footprints)
ENUM_MAP & Undefined(T aValue)
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()
class PCB_TEXT, text on a layer
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
class ARC, an arc track segment on a copper layer
void SetDrawCoord()
Set relative coordinates.
void SetOrigin(const wxPoint &pos)
show footprints values (when texts are visibles)
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
functions to convert a shape built with DRAWSEGMENTS to a polygon.
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.
void NORMALIZE_ANGLE_180(T &Angle)
void RotatePoint(int *pX, int *pY, double angle)
like PAD_PTH, but not plated mechanical use only, no connection allowed
The base class for create windows for drawing purpose.
void SetType(TEXT_TYPE aType)
std::unordered_set< BOARD_ITEM * > & GetItems()
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 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)
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
const char * c_str() const
int GetCount() const
Return the number of objects in the list.
void SetClosed(bool aClosed)
Function SetClosed()
PCB_LAYER_ID
A quick note on layer IDs:
Display value expressed in distance units (mm/inch)
const COLLECTORS_GUIDE * GetGuide() const
LSET is a set of PCB_LAYER_IDs.
void SetFlags(STATUS_FLAGS aMask)
#define MALFORMED_B_COURTYARD
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)
void SetEnd(int x, int y)
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
const wxString & GetName() const
static LSET AllLayersMask()
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
#define MALFORMED_COURTYARDS
void Simplify(POLYGON_MODE aFastMode)
ZONE handles a list of polygons defining a copper zone.
#define STRUCT_DELETED
flag indication structures to be erased
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
int NewOutline()
Creates a new hole in a given outline.
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,...
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
void SetPos0(const wxPoint &aPos)
static const int ORPHANED
NETINFO_ITEM meaning that there was no net assigned for an item, as there was no board storing net li...
class FOOTPRINT, a footprint
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,...
#define MALFORMED_F_COURTYARD
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 MARKER_PCB, a marker used to show something
virtual wxString GetClass() const =0
Return the class name.
bool IsType(FRAME_T aType) const
wxString GetReferencePrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
wxPoint GetPosition() const override
Information pertinent to a Pcbnew printed circuit board.
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.
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const wxPoint &pt)> OUTLINE_ERROR_HANDLER
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
void ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew)
Replace an existing property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
void CacheTriangulation(bool aPartition=true)
class 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.
PCB_SHAPE_TYPE_T GetShape() const
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
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)
STATUS_FLAGS GetFlags() const
BOARD_ITEM_CONTAINER * GetParent() const
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.
FP_ZONE is a specialization of ZONE for use in footprints.
show footprints references (when texts are visibles)
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
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.