42 std::vector<SEARCH_TERM> terms;
46 wxStringTokenizer keywordTokenizer(
GetKeyWords(), wxS(
" " ), wxTOKEN_STRTOK );
48 while( keywordTokenizer.HasMoreTokens() )
49 terms.emplace_back(
SEARCH_TERM( keywordTokenizer.GetNextToken(), 4 ) );
52 std::map<wxString, wxString> fields;
55 for(
const auto& [
name,
text ] : fields )
64 if( !footprint.IsEmpty() )
78 aColumnMap[field->
GetName()] = field->EDA_TEXT::GetShownText(
false );
101 m_excludedFromSim( false ),
102 m_excludedFromBOM( false ),
103 m_excludedFromBoard( false )
168 wxFAIL_MSG(
"Failed to clone LIB_ITEM." );
182 if( &aSymbol ==
this )
238 parent = parent->GetParent().lock();
245#define REPORT( msg ) { if( aReporter ) aReporter->Report( msg ); }
246#define ITEM_DESC( item ) ( item )->GetItemDescription( &unitsProvider )
275 REPORT(
_(
"Power flag differs." ) );
284 REPORT(
_(
"Unit count differs." ) );
293 std::set<const LIB_ITEM*, LIB_ITEM::cmp_items> aShapes;
294 std::set<const LIB_ITEM*> aFields;
295 std::set<const LIB_ITEM*, LIB_ITEM::cmp_items> aPins;
300 aShapes.insert( &(*it) );
302 aFields.insert( &(*it) );
304 aPins.insert( &(*it) );
307 std::set<const LIB_ITEM*, LIB_ITEM::cmp_items> bShapes;
308 std::set<const LIB_ITEM*> bFields;
309 std::set<const LIB_ITEM*, LIB_ITEM::cmp_items> bPins;
314 bShapes.insert( &(*it) );
316 bFields.insert( &(*it) );
318 bPins.insert( &(*it) );
321 if(
int tmp =
static_cast<int>( aShapes.size() - bShapes.size() ) )
324 REPORT(
_(
"Graphic item count differs." ) );
331 for(
auto aIt = aShapes.begin(), bIt = bShapes.begin(); aIt != aShapes.end(); aIt++, bIt++ )
333 if(
int tmp2 = (*aIt)->compare( *(*bIt), aCompareFlags ) )
344 if(
int tmp =
static_cast<int>( aPins.size() - bPins.size() ) )
347 REPORT(
_(
"Pin count differs." ) );
354 for(
const LIB_ITEM* aPinItem : aPins )
368 else if(
int tmp2 = aPinItem->compare( *bPin, aCompareFlags ) )
379 for(
const LIB_ITEM* aFieldItem : aFields )
396 tmp = aFieldItem->
compare( *bField, aCompareFlags );
402 REPORT( wxString::Format(
_(
"%s field differs." ), aField->
GetName(
false ) ) );
409 if(
int tmp =
static_cast<int>( aFields.size() - bFields.size() ) )
412 REPORT(
_(
"Field count differs." ) );
421 REPORT(
_(
"Footprint filters differs." ) );
428 for(
size_t i = 0; i <
m_fpFilters.GetCount(); i++ )
433 REPORT(
_(
"Footprint filters differ." ) );
444 REPORT(
_(
"Symbol keywords differ." ) );
453 REPORT(
_(
"Symbol pin name offsets differ." ) );
464 REPORT(
_(
"Show pin names settings differ." ) );
473 REPORT(
_(
"Show pin numbers settings differ." ) );
482 REPORT(
_(
"Exclude from simulation settings differ." ) );
491 REPORT(
_(
"Exclude from bill of materials settings differ." ) );
500 REPORT(
_(
"Exclude from board settings differ." ) );
533 return sp->GetRootSymbol();
568 aTarget[it.first] = it.second;
577 if( aName.Length() > 0 )
607 std::unique_ptr< LIB_SYMBOL > retv;
613 wxCHECK_MSG( parent, retv,
614 wxString::Format(
"Parent of derived symbol '%s' undefined",
m_name ) );
617 if( parent->IsAlias() )
618 retv = parent->Flatten();
620 retv = std::make_unique<LIB_SYMBOL>( *parent.get() );
632 retv->GetFieldById( i )->SetText( retv->GetFieldById( i )->GetText() );
642 wxCHECK2( aliasField,
continue );
655 retv->AddDrawItem( newField );
659 retv->RemoveDrawItem( parentField );
660 retv->AddDrawItem( newField );
667 retv->SetExcludedFromSim( parent->GetExcludedFromSim() );
668 retv->SetExcludedFromBOM( parent->GetExcludedFromBOM() );
669 retv->SetExcludedFromBoard( parent->GetExcludedFromBoard() );
671 retv->UpdateFieldOrdinals();
675 retv = std::make_unique<LIB_SYMBOL>( *
this );
688 eda_text->ClearBoundingBoxCache();
689 eda_text->ClearRenderCache();
708 if( parent->IsRoot() )
711 return parent->IsPower();
722 if( parent->IsRoot() )
736 if( parent->IsRoot() )
739 return parent->IsNormal();
750 if( parent->IsRoot() )
770 u = ( aUnit - 1 ) % 26;
771 suffix = wxChar( aFirstId + u ) + suffix;
772 aUnit = ( aUnit - u ) / 26;
773 }
while( aUnit > 0 );
792 if( item.IsPrivate() )
800 if( aUnit && shape.
m_unit && ( shape.
m_unit != aUnit ) )
806 if( shape.
GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
807 shape.
Print( aSettings, aOffset, (
void*)
false, aOpts.
transform, aDimmed );
821 if( item.IsPrivate() )
825 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
828 if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
844 item.
Print( aSettings, aOffset, (
void*) &aOpts, aOpts.
transform, aDimmed );
848 item.Print( aSettings, aOffset,
nullptr, aOpts.
transform, aDimmed );
853 bool forceNoFill = shape.
GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR;
855 shape.
Print( aSettings, aOffset, (
void*) forceNoFill, aOpts.
transform, aDimmed );
859 item.Print( aSettings, aOffset, (
void*)
false, aOpts.
transform, aDimmed );
868 wxASSERT( aPlotter !=
nullptr );
873 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
887 if( item.IsPrivate() )
895 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
898 if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
901 item.Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
910 wxASSERT( aPlotter !=
nullptr );
915 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->
GetColorMode() )
931 if( !aPlotHidden && !( (
LIB_FIELD&) item ).IsVisible() )
952 item.
Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
960 std::vector<LIB_SHAPE*> potential_top_items;
961 std::vector<LIB_ITEM*> bottom_items;
969 if( shape.
GetFillMode() == FILL_T::FILLED_WITH_COLOR )
970 potential_top_items.push_back( &shape );
972 bottom_items.push_back( &item );
976 bottom_items.push_back( &item );
980 std::sort( potential_top_items.begin(), potential_top_items.end(),
983 return a->GetBoundingBox().GetArea() > b->GetBoundingBox().GetArea();
987 for(
LIB_SHAPE* item : potential_top_items )
989 for(
LIB_ITEM* bottom_item : bottom_items )
991 if( item->GetBoundingBox().Contains( bottom_item->GetBoundingBox() ) )
993 item->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
1003 wxASSERT( aItem !=
nullptr );
1009 if(
static_cast<LIB_FIELD*
>( aItem )->IsMandatory() )
1015 for( LIB_ITEMS::iterator i = items.begin(); i != items.end(); i++ )
1052 if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
1056 if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
1066 std::vector<LIB_PIN*> pinList;
1075 std::vector<LIB_PIN*> pinList;
1078 return pinList.size();
1086 GetPins( pinList, aUnit, aBodyStyle );
1092 if( aNumber ==
pin->GetNumber() )
1101 bool aTestType,
bool aTestOrientation,
bool aTestLength )
const
1106 for(
const LIB_PIN* eachThisPin : thisPinList )
1108 wxASSERT( eachThisPin );
1110 aOtherPart.
GetPins( otherPinList, 0, 0 );
1111 bool foundMatch =
false;
1113 for(
const LIB_PIN* eachOtherPin : otherPinList )
1115 wxASSERT( eachOtherPin );
1118 if( eachThisPin->GetUnit() != eachOtherPin->GetUnit() )
1122 if( eachThisPin->GetBodyStyle() != eachOtherPin->GetBodyStyle() )
1126 if( eachThisPin->GetPosition() != eachOtherPin->GetPosition() )
1130 if( aTestNums && ( eachThisPin->GetNumber() != eachOtherPin->GetNumber() ) )
1134 if( aTestNames && ( eachThisPin->GetName() != eachOtherPin->GetName() ) )
1138 if( aTestType && ( eachThisPin->GetType() != eachOtherPin->GetType() ) )
1142 if( aTestOrientation
1143 && ( eachThisPin->GetOrientation() != eachOtherPin->GetOrientation() ) )
1147 if( aTestLength && ( eachThisPin->GetLength() != eachOtherPin->GetLength() ) )
1168 bool aIgnoreHiddenFields )
const
1177 && aUnit != item.m_unit )
1182 if( item.m_bodyStyle > 0 && aBodyStyle > 0 && aBodyStyle != item.m_bodyStyle )
1185 if( aIgnoreHiddenFields && ( item.Type() ==
LIB_FIELD_T )
1211 bool aIncludePrivateItems )
const
1217 if( item.m_unit > 0 && aUnit > 0 && aUnit != item.m_unit )
1220 if( item.m_bodyStyle > 0 && aBodyStyle > 0 && aBodyStyle != item.m_bodyStyle )
1223 if( item.IsPrivate() && !aIncludePrivateItems )
1233 if(
pin.IsVisible() )
1239 bbox.
Merge(
pin.GetBoundingBox(
false,
false,
false ) );
1246 bbox.
Merge( item.GetBoundingBox() );
1270 for(
size_t ii = 0; ii < aFields.size(); ++ii )
1295 aList.push_back( field );
1312 aList.push_back( *field );
1323 if( field->
GetId() == aId )
1335 if( aCaseInsensitive )
1337 if(
static_cast<LIB_FIELD*
>( &item )->GetCanonicalName().Upper() == aFieldName.Upper() )
1338 return static_cast<LIB_FIELD*
>( &item );
1343 return static_cast<LIB_FIELD*
>( &item );
1352 const bool aCaseInsensitive )
const
1356 if( aCaseInsensitive )
1358 if(
static_cast<const LIB_FIELD*
>( &item )->GetCanonicalName().Upper()
1359 == aFieldName.Upper() )
1360 return static_cast<const LIB_FIELD*
>( &item );
1365 return static_cast<const LIB_FIELD*
>( &item );
1376 wxASSERT( field !=
nullptr );
1384 wxASSERT( field !=
nullptr );
1392 wxASSERT( field !=
nullptr );
1400 wxASSERT( field !=
nullptr );
1408 wxASSERT( field !=
nullptr );
1417 refDesignator.Replace( wxS(
"~" ), wxS(
" " ) );
1419 wxString prefix = refDesignator;
1421 while( prefix.Length() )
1423 wxUniCharRef last = prefix.Last();
1425 if( ( last >=
'0' && last <=
'9' ) || last ==
'?' || last ==
'*' )
1426 prefix.RemoveLast();
1432 prefix.Trim(
true );
1433 prefix.Trim(
false );
1455 wxCHECK2( field,
continue );
1461 if( field->
GetId() != lastOrdinal )
1463 field->
SetId( lastOrdinal );
1488 item.Offset( aOffset );
1508 for(
const LIB_ITEM& item : parent->GetDrawItems() )
1521 int maxPinNumber = 0;
1528 long currentPinNumber = 0;
1530 if(
pin->GetNumber().ToLong( ¤tPinNumber ) )
1531 maxPinNumber = std::max( maxPinNumber, (
int) currentPinNumber );
1534 return maxPinNumber;
1541 item.ClearTempFlags();
1548 item.ClearEditFlags();
1557 if( ( aUnit && item.m_unit && aUnit != item.m_unit )
1558 || ( aBodyStyle && item.m_bodyStyle && aBodyStyle != item.m_bodyStyle )
1564 if( item.HitTest( aPoint ) )
1594 const std::vector<KICAD_T>& aScanTypes )
1599 if( item.IsType( aScanTypes ) )
1601 if( aInspector( &item, aTestData ) == INSPECT_RESULT::QUIT )
1602 return INSPECT_RESULT::QUIT;
1606 return INSPECT_RESULT::CONTINUE;
1621 if( i->m_unit > aCount )
1627 else if( aDuplicateDrawItems )
1634 std::vector< LIB_ITEM* > tmp;
1638 if( item.m_unit != 1 )
1641 for(
int j = prevCount + 1; j <= aCount; j++ )
1645 tmp.push_back( newItem );
1661 return parent->GetUnitCount();
1675 if( aDuplicatePins )
1677 std::vector< LIB_ITEM* > tmp;
1685 if( item.m_bodyStyle == 1 )
1689 tmp.push_back( newItem );
1694 for(
unsigned i = 0; i < tmp.size(); i++ )
1706 if( i->m_bodyStyle > 1 )
1719 std::vector<LIB_ITEM*> unitItems;
1726 if( ( aBodyStyle == -1 && item.GetUnit() == aUnit )
1727 || ( aUnit == -1 && item.GetBodyStyle() == aBodyStyle )
1728 || ( aUnit == item.GetUnit() && aBodyStyle == item.GetBodyStyle() ) )
1730 unitItems.push_back( &item );
1740 std::vector<struct LIB_SYMBOL_UNIT> units;
1747 int unit = item.GetUnit();
1748 int bodyStyle = item.GetBodyStyle();
1750 auto it = std::find_if( units.begin(), units.end(),
1753 return a.m_unit == unit && a.m_bodyStyle == bodyStyle;
1756 if( it == units.end() )
1759 newUnit.
m_unit = item.GetUnit();
1761 newUnit.
m_items.push_back( &item );
1762 units.emplace_back( newUnit );
1766 it->m_items.push_back( &item );
1779 std::vector<LIB_ITEM*> compareDrawItems;
1780 std::vector<LIB_ITEM*> currentDrawItems;
1781 std::vector<struct LIB_SYMBOL_UNIT> uniqueUnits;
1789 if( unit.
m_items.size() == 0 )
1792 uniqueUnits.emplace_back( unit );
1797 currentDrawItems = unit.
m_items;
1799 for( unitNum = 2; unitNum <=
GetUnitCount(); unitNum++ )
1803 wxCHECK2_MSG( compareDrawItems.size() != 0,
continue,
1804 "Multiple unit symbol defined with empty units." );
1806 if( currentDrawItems.size() != compareDrawItems.size() )
1810 unit.
m_items = compareDrawItems;
1811 uniqueUnits.emplace_back( unit );
1815 for( i = 0; i < currentDrawItems.size(); i++ )
1817 if( currentDrawItems[i]->compare( *compareDrawItems[i],
1822 unit.
m_items = compareDrawItems;
1823 uniqueUnits.emplace_back( unit );
1837 unit.
m_items = currentDrawItems;
1838 uniqueUnits.emplace_back( unit );
1843 for( unitNum = 2; unitNum <=
GetUnitCount(); unitNum++ )
1847 wxCHECK2_MSG( compareDrawItems.size() != 0,
continue,
1848 "Multiple unit symbol defined with empty units." );
1850 if( currentDrawItems.size() != compareDrawItems.size() )
1854 unit.
m_items = compareDrawItems;
1855 uniqueUnits.emplace_back( unit );
1859 for( i = 0; i < currentDrawItems.size(); i++ )
1861 if( currentDrawItems[i]->compare( *compareDrawItems[i],
1866 unit.
m_items = compareDrawItems;
1867 uniqueUnits.emplace_back( unit );
1913 if( !( *it1 == *it2 ) )
1920 if( thisPinList.size() != otherPinList.size() )
1923 for(
auto it1 = thisPinList.begin(), it2 = otherPinList.begin();
1924 it1 != thisPinList.end(); ++it1, ++it2 )
1926 if( !( **it1 == **it2 ) )
1929 for(
size_t ii = 0; ii < thisPinList.size(); ++ii )
1931 if( !( *thisPinList[ii] == *otherPinList[ii] ) )
1941 double similarity = 0.0;
1950 double max_similarity = 0.0;
1954 double temp_similarity = item.Similarity( otherItem );
1955 max_similarity = std::max( max_similarity, temp_similarity );
1957 if( max_similarity == 1.0 )
1961 similarity += max_similarity;
1967 double max_similarity = 0.0;
1971 double temp_similarity =
pin->Similarity( *otherPin );
1972 max_similarity = std::max( max_similarity, temp_similarity );
1974 if( max_similarity == 1.0 )
1978 similarity += max_similarity;
1981 if( totalItems == 0 )
1984 similarity /= totalItems;
constexpr EDA_IU_SCALE schIUScale
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
EDA_ITEM_FLAGS GetFlags() const
FILL_T GetFillMode() 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
virtual void SetText(const wxString &aText)
A color representation with 4 components: red, green, blue, alpha.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual const COLOR4D & GetBackgroundColor() const =0
Return current background color settings.
Field object used in symbol libraries.
bool ShowInChooser() const
void Plot(PLOTTER *aPlotter, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const override
Plot the draw item using the plot object.
wxString GetFullText(int unit=1) const
Return the text of a field.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
int compare(const LIB_ITEM &aOther, int aCompareFlags=0) const override
Provide the draw object specific comparison called by the == and < operators.
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
int compare(const LIB_ID &aLibId) const
Compare the contents of LIB_ID objects by performing a std::string comparison of the library nickname...
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
The base class for drawable items used by schematic library symbols.
LIB_ITEM * Duplicate() const
Create a copy of this LIB_ITEM (with a new Uuid).
virtual void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, void *aData, const TRANSFORM &aTransform, bool aDimmed)
Draw an item.
int m_bodyStyle
Shape identification for alternate body styles.
int m_unit
Unit identification for multiple parts per package.
const wxString & GetNumber() const
Define a library symbol object.
LIB_ITEMS_CONTAINER m_drawings
bool HasAlternateBodyStyle() const
Test if symbol has more than one body conversion type (DeMorgan).
void ClearTempFlags()
Clears the status flag all draw objects in this symbol.
LIB_PIN * GetPin(const wxString &aNumber, int aUnit=0, int aBodyStyle=0) const
Return pin object with the requested pin aNumber.
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
void PlotLibFields(PLOTTER *aPlotter, int aUnit, int aBodyStyle, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed, bool aPlotHidden=true)
Plot Lib Fields only of the symbol to plotter.
void RemoveDrawItem(LIB_ITEM *aItem)
Remove draw aItem from list.
void RunOnChildren(const std::function< void(LIB_ITEM *)> &aFunction)
bool PinsConflictWith(const LIB_SYMBOL &aOtherSymbol, bool aTestNums, bool aTestNames, bool aTestType, bool aTestOrientation, bool aTestLength) const
Return true if this symbol's pins do not match another symbol's pins.
wxString GetKeyWords() const
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
bool UnitsLocked() const
Check whether symbol units are interchangeable.
const BOX2I GetUnitBoundingBox(int aUnit, int aBodyStyle, bool aIgnoreHiddenFields=true) const
Get the bounding box for the symbol.
int GetNextAvailableFieldId() const
bool operator==(const LIB_SYMBOL *aSymbol) const
std::map< int, wxString > m_unitDisplayNames
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
const wxString GetLibraryName() const
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
std::vector< SEARCH_TERM > GetSearchTerms() override
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of LIB_ITEM objects separated by unit and convert number.
int GetMaxPinNumber() const
LIB_SYMBOL(const wxString &aName, LIB_SYMBOL *aParent=nullptr, SYMBOL_LIB *aLibrary=nullptr)
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
int Compare(const LIB_SYMBOL &aRhs, int aCompareFlags=0, REPORTER *aReporter=nullptr) const
Comparison test that can be used for operators.
void FixupDrawItems()
This function finds the filled draw items that are covering up smaller draw items and replaces their ...
static wxString LetterSubReference(int aUnit, int aFirstId)
wxString m_keyWords
Search keywords.
void GetPins(LIB_PINS &aList, int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
LIB_FIELD & GetFootprintField()
Return reference to the footprint field.
LIB_FIELD & GetDescriptionField()
Return reference to the description field.
void RemoveDuplicateDrawItems()
Remove duplicate draw items from list.
void SetParent(LIB_SYMBOL *aParent=nullptr)
wxString GetName() const override
int m_pinNameOffset
The offset in mils to draw the pin name.
LIB_FIELD * FindField(const wxString &aFieldName, bool aCaseInsensitive=false)
Find a field within this symbol matching aFieldName and returns it or NULL if not found.
void GetFields(std::vector< LIB_FIELD * > &aList)
Return a list of fields within this symbol.
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti, int aBodyStyle, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
Print symbol.
void GetChooserFields(std::map< wxString, wxString > &aColumnMap) override
Retrieves a key/value map of the fields on this item that should be exposed to the library browser/ch...
timestamp_t m_lastModDate
double Similarity(const LIB_SYMBOL &aSymbol) const
Return a measure of similarity between this symbol and aSymbol.
void SetLib(SYMBOL_LIB *aLibrary)
std::vector< struct LIB_SYMBOL_UNIT > GetUniqueUnits()
Return a list of unit numbers that are unique to this symbol.
const LIB_SYMBOL & operator=(const LIB_SYMBOL &aSymbol)
LIB_FIELD & GetValueField()
Return reference to the value field.
bool m_unitsLocked
True if symbol has multiple units and changing one unit does not automatically change another unit.
wxArrayString m_fpFilters
List of suitable footprint names for the symbol (wild card names accepted).
bool HasUnitDisplayName(int aUnit) override
Return true if the given unit aUnit has a display name defined.
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti, int aBodyStyle, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
Print just the background fills of a symbol.
const BOX2I GetBodyBoundingBox(int aUnit, int aBodyStyle, bool aIncludePins, bool aIncludePrivateItems) const
Get the symbol bounding box excluding fields.
LIB_SYMBOL_SPTR SharedPtr() const
int UpdateFieldOrdinals()
Order optional field indices.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
wxString GetUnitReference(int aUnit) override
Return an identifier for aUnit for symbols with units.
wxString GetDescription() override
void Plot(PLOTTER *aPlotter, int aUnit, int aBodyStyle, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const
Plot lib symbol to plotter.
std::vector< LIB_PIN * > GetAllLibPins() const
Return a list of pin pointers for all units / converts.
int m_unitCount
Number of units (parts) per package.
void SetHasAlternateBodyStyle(bool aHasAlternate, bool aDuplicatePins=true)
Set or clear the alternate body style (DeMorgan) for the symbol.
unsigned GetInheritanceDepth() const
Get the number of parents for this symbol.
int GetUnitCount() const override
For items with units, return the number of units.
void AddField(LIB_FIELD *aField)
Add a field.
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
int GetPinCount() override
LIB_SYMBOL_REF & GetParent()
LIB_SYMBOL_SPTR GetRootSymbol() const
Get the parent symbol that does not have another parent.
void SetFields(const std::vector< LIB_FIELD > &aFieldsList)
Overwrite all the existing fields in this symbol with fields supplied in aFieldsList.
void SetUnitDisplayName(int aUnit, const wxString &aName)
Set the user-defined display name for aUnit to aName for symbols with units.
void SetOffset(const VECTOR2I &aOffset)
Move the symbol aOffset.
virtual void SetName(const wxString &aName)
void CopyUnitDisplayNames(std::map< int, wxString > &aTarget) const
Copy all unit display names into the given map aTarget.
LIB_ITEM * LocateDrawItem(int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I &aPoint)
Locate a draw object.
size_t size(int aType=UNDEFINED_TYPE) const
void unique()
Remove duplicate elements in list.
ITERATOR_BASE< LIB_ITEM, MULTIVECTOR< LIB_ITEM, FIRST_TYPE_VAL, LAST_TYPE_VAL >, typename ITEM_PTR_VECTOR::iterator > ITERATOR
The const iterator.
ITERATOR end(int aType=UNDEFINED_TYPE)
void clear(int aType=UNDEFINED_TYPE)
ITERATOR erase(const ITERATOR &aIterator)
ITERATOR begin(int aType=UNDEFINED_TYPE)
Base plotter engine class.
RENDER_SETTINGS * RenderSettings()
bool GetColorMode() const
virtual void SetColor(const COLOR4D &color)=0
A pure virtual class used to derive REPORTER objects from.
Object used to load, save, search, and otherwise manipulate symbol library files.
const wxString GetName() const
Return the file name without path or extension.
#define DEFAULT_PIN_NAME_OFFSET
The intersheets references prefix string.
const INSPECTOR_FUNC & INSPECTOR
#define IS_NEW
New item, just created.
#define STRUCT_DELETED
flag indication structures to be erased
TRANSFORM DefaultTransform
bool GetGRForceBlackPenState(void)
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
bool operator<(const LIB_SYMBOL &aItem1, const LIB_SYMBOL &aItem2)
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
constexpr int MilsToIU(int mils) const
std::vector< LIB_ITEM * > m_items
The items unique to this unit and alternate body style.
int m_bodyStyle
The alternate body style of the unit.
int m_unit
The unit number.
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
void operator()(void const *) const
Definition for symbol library class.
@ DATASHEET_FIELD
name of datasheet
@ FOOTPRINT_FIELD
Field Name Module PCB, i.e. "16DIP300".
@ VALUE_FIELD
Field Value of part, i.e. "3.3K".
@ MANDATORY_FIELDS
The first 5 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors.
@ REFERENCE_FIELD
Field Reference of part, i.e. "IC21".
@ DESCRIPTION_FIELD
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.