140 return wxT(
"LIB_SYMBOL" );
148 virtual void SetName(
const wxString& aName );
175 return parent->GetDescription();
188 return parent->GetKeyWords();
201 void GetChooserFields( std::map<wxString , wxString>& aColumnMap )
override;
223 return parent->GetFPFilters();
240 bool aIgnoreHiddenFields =
true )
const;
258 bool aIncludePrivateItems )
const;
296 void SetFields(
const std::vector<SCH_FIELD>& aFieldsList );
303 void GetFields( std::vector<SCH_FIELD*>& aList,
bool aVisibleOnly =
false )
const override;
308 void CopyFields( std::vector<SCH_FIELD>& aList );
361 bool aAllowExtraText )
const override
366 std::set<KIFONT::OUTLINE_FONT*>
GetFonts()
const override;
391 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed )
override;
397 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed );
426 std::vector<SCH_PIN*>
GetPins(
int aUnit,
int aBodyStyle )
const;
432 std::vector<SCH_PIN*>
GetPins()
const override;
448 SCH_PIN*
GetPin(
const wxString& aNumber,
int aUnit = 0,
int aBodyStyle = 0 )
const;
462 bool aTestType,
bool aTestOrientation,
bool aTestLength )
const;
529 const std::vector<KICAD_T>& aScanTypes )
override;
542 void SetUnitCount(
int aCount,
bool aDuplicateDrawItems =
true );
581 std::optional<const std::set<wxString>>
GetJumperPinGroup(
const wxString& aPinNumber )
const;
614 REPORTER* aReporter =
nullptr )
const;
625 std::unique_ptr< LIB_SYMBOL >
Flatten()
const;
655 void Show(
int nestLevel, std::ostream& os )
const override { ShowDummy( os ); }
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 const wxString & GetText() const
Return the string associated with the text object.
Class OUTLINE_FONT implements outline font drawing.
A logical library item identifier and consists of various portions much like a URI.
Define a library symbol object.
LIB_ITEMS_CONTAINER m_drawings
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
SCH_FIELD & GetDescriptionField()
Return reference to the description field.
wxString GetDescription() const override
const LIB_ID & GetLibId() const override
wxString GetKeyWords() const override
bool IsMulti() const override
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
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.
void GetFields(std::vector< SCH_FIELD * > &aList, bool aVisibleOnly=false) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
bool IsPower() const override
void SetSourceLibId(const LIB_ID &aLibId)
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
bool UnitsLocked() const
Check whether symbol units are interchangeable.
SCH_FIELD & GetDatasheetField()
Return reference to the datasheet field.
const BOX2I GetUnitBoundingBox(int aUnit, int aBodyStyle, bool aIgnoreHiddenFields=true) const
Get the bounding box for the symbol.
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of SCH_ITEM objects separated by unit and convert number.
void RemoveField(SCH_FIELD *aField)
std::map< int, wxString > m_unitDisplayNames
std::vector< std::set< wxString > > m_jumperPinGroups
A list of jumper pin groups, each of which is a set of pin numbers that should be jumpered together (...
void ClearTempFlags() override
Clears the status flag all draw objects in this symbol.
void SetDuplicatePinNumbersAreJumpers(bool aEnabled)
wxString GetFootprint() override
For items with footprint fields.
wxString GetUnitDisplayName(int aUnit) override
Return the user-defined display name for aUnit for symbols with units.
const wxString GetLibraryName() const
void SetFields(const std::vector< SCH_FIELD > &aFieldsList)
Overwrite all the existing fields in this symbol with fields supplied in aFieldsList.
std::vector< SEARCH_TERM > GetSearchTerms() override
timestamp_t GetLastModDate() const
LIB_ID GetSourceLibId() const
int GetMaxPinNumber() const
virtual LIB_SYMBOL * Duplicate() const
Create a copy of a LIB_SYMBOL and assigns unique KIIDs to the copy and its children.
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
SCH_FIELD * GetField(const wxString &aFieldName)
Find a field within this symbol matching aFieldName; return nullptr if not found.
SCH_FIELD & GetFootprintField()
Return reference to the footprint field.
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)
SCH_PIN * GetPin(const wxString &aNumber, int aUnit=0, int aBodyStyle=0) const
Return pin object with the requested pin aNumber.
bool IsNormal() const override
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
bool HasAlternateBodyStyle() const override
Test if symbol has more than one body conversion type (DeMorgan).
static bool ClassOf(const EDA_ITEM *aItem)
SCH_FIELD * FindFieldCaseInsensitive(const wxString &aFieldName)
const std::vector< std::set< wxString > > & JumperPinGroups() const
wxString m_keyWords
Search keywords.
SCH_ITEM * LocateDrawItem(int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I &aPoint)
Locate a draw object.
double Similarity(const SCH_ITEM &aSymbol) const override
Return a measure of similarity between this symbol and aSymbol.
static LIB_SYMBOL * GetDummy()
Returns a dummy LIB_SYMBOL, used when one is missing in the schematic.
void PlotFields(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed)
Plot symbol fields.
void LockUnits(bool aLockUnits)
Set interchangeable the property for symbol units.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
void SetParent(LIB_SYMBOL *aParent=nullptr)
wxString GetName() const override
void SetDescription(const wxString &aDescription)
Gets the Description field text value */.
const LIB_SYMBOL_REF & GetParent() const
void SetKeyWords(const wxString &aKeyWords)
SCH_FIELD & GetValueField()
Return reference to the value field.
bool IsLocalPower() const override
wxArrayString GetFPFilters() const
void RemoveDrawItem(SCH_ITEM *aItem)
Remove draw aItem from list.
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...
int compare(const SCH_ITEM &aOther, int aCompareFlags=SCH_ITEM::COMPARE_FLAGS::EQUALITY) const override
The library symbol specific sort order is as follows:
timestamp_t m_lastModDate
std::optional< const std::set< wxString > > GetJumperPinGroup(const wxString &aPinNumber) const
Retrieves the jumper group containing the specified pin number, if one exists.
void SetLib(SYMBOL_LIB *aLibrary)
std::vector< SCH_PIN * > GetPins() const override
Return a list of pin pointers for all units / converts.
int GetSubUnitCount() const override
For items with units, return the number of units.
wxString GetLibNickname() const override
Sets the Description field text value.
void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo) override
Automatically orient all the fields in the symbol.
const LIB_SYMBOL & operator=(const LIB_SYMBOL &aSymbol)
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).
void Move(const VECTOR2I &aOffset) override
Move the symbol aOffset.
void SetFPFilters(const wxArrayString &aFilters)
bool HasUnitDisplayName(int aUnit) override
Return true if the given unit aUnit has a display name defined.
void CopyFields(std::vector< SCH_FIELD > &aList)
Create a copy of the SCH_FIELDs, sorted in ordinal order.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
LIB_SYMBOL_SPTR SharedPtr() const
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared.
const wxString GetValue(bool aResolve, const SCH_SHEET_PATH *aPath, bool aAllowExtraText) const override
wxString GetDesc() override
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...
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const override
wxString GetUnitReference(int aUnit) override
Return an identifier for aUnit for symbols with units.
EMBEDDED_FILES * GetEmbeddedFiles() override
void AddField(SCH_FIELD &aField)
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.
virtual wxString GetClass() const override
Return the class name.
bool IsGlobalPower() const override
LIB_ID m_sourceLibId
For database library symbols; the original symbol.
unsigned GetInheritanceDepth() const
Get the number of parents for this symbol.
int GetUnitCount() const override
LIB_SYMBOL_REF m_parent
Use for inherited symbols.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
BOX2I GetBodyBoundingBox() const override
Return a bounding box for the symbol body but not the pins or fields.
SYMBOL_LIB * GetLib() const
int GetPinCount() override
BOX2I GetBodyAndPinsBoundingBox() const override
Return a bounding box for the symbol body and pins but not the fields.
void SetLibId(const LIB_ID &aLibId)
void AddField(SCH_FIELD *aField)
Add a field.
void ClearEditFlags() override
bool GetDuplicatePinNumbersAreJumpers() const
LIB_ID GetLIB_ID() const override
LIB_SYMBOL_REF & GetParent()
bool m_duplicatePinNumbersAreJumpers
Flag that this symbol should automatically treat sets of two or more pins with the same number as jum...
LIB_SYMBOL_SPTR GetRootSymbol() const
Get the parent symbol that does not have another parent.
std::vector< std::set< wxString > > & JumperPinGroups()
Each jumper pin group is a set of pin numbers that should be treated as internally connected.
void SetUnitDisplayName(int aUnit, const wxString &aName)
Set the user-defined display name for aUnit to aName for symbols with units.
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
void EmbedFonts() override
virtual void SetName(const wxString &aName)
void CopyUnitDisplayNames(std::map< int, wxString > &aTarget) const
Copy all unit display names into the given map aTarget.
SCH_FIELD & GetReferenceField()
Return reference to the reference designator field.
const LIB_ITEMS_CONTAINER & GetDrawItems() const
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this symbol.
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Multivector container type.
boost::ptr_vector< SCH_ITEM > ITEM_PTR_VECTOR
Helper for defining a list of library draw object pointers.
Base plotter engine class.
A pure virtual class used to derive REPORTER objects from.
void SetText(const wxString &aText) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Object used to load, save, search, and otherwise manipulate symbol library files.
A base class for LIB_SYMBOL and SCH_SYMBOL.
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
uint32_t timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
std::weak_ptr< LIB_SYMBOL > LIB_SYMBOL_REF
weak pointer to LIB_SYMBOL
MULTIVECTOR< SCH_ITEM, SCH_SHAPE_T, SCH_PIN_T > LIB_ITEMS_CONTAINER
std::shared_ptr< LIB_SYMBOL > LIB_SYMBOL_SPTR
shared pointer to LIB_SYMBOL
LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS
bool operator<(const LIB_SYMBOL &aItem1, const LIB_SYMBOL &aItem2)
int m_bodyStyle
The alternate body style of the unit.
std::vector< SCH_ITEM * > m_items
The items unique to this unit and alternate body style.
int m_unit
The unit number.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.