27#ifndef CLASS_LIBENTRY_H
28#define CLASS_LIBENTRY_H
151 return wxT(
"LIB_SYMBOL" );
159 virtual void SetName(
const wxString& aName );
183 return parent->GetDescription();
196 return parent->GetKeyWords();
209 void GetChooserFields( std::map<wxString , wxString>& aColumnMap )
override;
231 return parent->GetFPFilters();
237 void ViewGetLayers(
int aLayers[],
int& aCount )
const override;
262 bool aIncludePrivateItems )
const;
292 void SetFields(
const std::vector<LIB_FIELD>& aFieldsList );
299 void GetFields( std::vector<LIB_FIELD*>& aList );
300 void GetFields( std::vector<LIB_FIELD>& aList );
320 const bool aCaseInsensitive =
false )
const;
397 void Plot(
PLOTTER* aPlotter,
int aUnit,
int aConvert,
bool aBackground,
414 bool aPlotHidden =
true );
448 void GetPins(
LIB_PINS& aList,
int aUnit = 0,
int aConvert = 0 )
const;
470 LIB_PIN*
GetPin(
const wxString& aNumber,
int aUnit = 0,
int aConvert = 0 )
const;
484 bool aTestType,
bool aTestOrientation,
bool aTestLength )
const;
556 const std::vector<KICAD_T>& aScanTypes )
override;
569 void SetUnitCount(
int aCount,
bool aDuplicateDrawItems =
true );
611 static wxString
SubReference(
int aUnit,
bool aAddSeparator =
true );
651 void SetConversion(
bool aSetConvert,
bool aDuplicatePins =
true );
713 REPORTER* aReporter =
nullptr )
const;
735 std::unique_ptr< LIB_SYMBOL >
Flatten()
const;
768 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.
virtual void SetText(const wxString &aText)
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Field object used in symbol libraries.
A logical library item identifier and consists of various portions much like a URI.
The base class for drawable items used by schematic library symbols.
Define a library symbol object.
LIB_ITEMS_CONTAINER m_drawings
void Plot(PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed) const
Plot lib symbol to plotter.
void PrintBackground(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
Print just the background fills of a symbol.
bool operator!=(const LIB_SYMBOL &aSymbol) const
void ClearTempFlags()
Clears the status flag all draw objects in this symbol.
static int GetSubpartIdSeparator()
LIBRENTRYOPTIONS m_options
Special symbol features such as POWER or NORMAL.)
void RemoveDrawItem(LIB_ITEM *aItem)
Remove draw aItem from list.
void RunOnChildren(const std::function< void(LIB_ITEM *)> &aFunction)
void RemoveField(LIB_FIELD *aField)
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 SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
int GetPinNameOffset() const
void SetSourceLibId(const LIB_ID &aLibId)
wxString GetKeyWords() const
void SetConversion(bool aSetConvert, bool aDuplicatePins=true)
Set or clear the alternate body style (DeMorgan) for the symbol.
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
void SetUnitCount(int aCount, bool aDuplicateDrawItems=true)
Set the units per symbol count.
static int m_subpartFirstId
the ASCII char value to calculate the subpart symbol id from the symbol number: only 'A',...
bool UnitsLocked() const
Check whether symbol units are interchangeable.
int GetNextAvailableFieldId() const
bool IsRoot() const override
For symbols derived from other symbols, IsRoot() indicates no derivation.
bool operator==(const LIB_SYMBOL *aSymbol) const
std::map< int, wxString > m_unitDisplayNames
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
LIB_FIELD * GetFieldById(int aId) const
Return pointer to the requested field.
std::vector< SEARCH_TERM > GetSearchTerms() override
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
timestamp_t GetLastModDate() const
LIB_ID GetSourceLibId() const
std::vector< struct LIB_SYMBOL_UNIT > GetUnitDrawItems()
Return a list of LIB_ITEM objects separated by unit and convert number.
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 ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
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 ...
bool operator==(const LIB_SYMBOL &aSymbol) const
static bool ClassOf(const EDA_ITEM *aItem)
wxString m_keyWords
Search keywords.
LIB_FIELD & GetFootprintField()
Return reference to the footprint field.
bool ShowPinNames() const
LIB_FIELD & GetDescriptionField()
Return reference to the description field.
void RemoveDuplicateDrawItems()
Remove duplicate draw items from list.
void LockUnits(bool aLockUnits)
Set interchangeable the property for symbol units.
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
LIB_ID GetLibId() const override
void SetParent(LIB_SYMBOL *aParent=nullptr)
wxString GetName() const override
void SetDescription(const wxString &aDescription)
Gets the Description field text value */.
static int m_subpartIdSeparator
the separator char between the subpart id and the reference like U1A ( m_subpartIdSeparator = 0 ) or ...
const LIB_SYMBOL_REF & GetParent() const
int m_pinNameOffset
The offset in mils to draw the pin name.
void SetKeyWords(const wxString &aKeyWords)
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.
wxArrayString GetFPFilters() const
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...
static wxString SubReference(int aUnit, bool aAddSeparator=true)
void PlotLibFields(PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground, const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed, bool aPlotHidden=true)
Plot Lib Fields only of the symbol to plotter.
void SetExcludedFromBOM(bool aExcludeFromBOM)
Set or clear the exclude from schematic bill of materials flag.
timestamp_t m_lastModDate
void SetLib(SYMBOL_LIB *aLibrary)
static int GetSubpartFirstId()
bool GetExcludedFromBOM() const
std::vector< struct LIB_SYMBOL_UNIT > GetUniqueUnits()
Return a list of unit numbers that are unique to this symbol.
void SetExcludedFromBoard(bool aExcludeFromBoard)
Set or clear exclude from board netlist flag.
wxString GetLibNickname() const override
Sets the Description field text value.
virtual ~LIB_SYMBOL()
http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
const BOX2I GetBodyBoundingBox(int aUnit, int aConvert, bool aIncludePins, bool aIncludePrivateItems) const
Get the symbol bounding box excluding fields.
static void SetSubpartIdNotation(int aSep, int aFirstId)
Set the separator char between the subpart id and the reference 0 (no separator) or '.
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 GetExcludedFromSim() const
void SetFPFilters(const wxArrayString &aFilters)
bool HasUnitDisplayName(int aUnit) override
Return true if the given unit aUnit has a display name defined.
size_t GetFieldCount() const
LIB_SYMBOL_SPTR SharedPtr() const
size_t GetPinCount() const
LIB_ITEM * LocateDrawItem(int aUnit, int aConvert, KICAD_T aType, const VECTOR2I &aPoint)
Locate a draw object.
LIB_SYMBOL_REF GetRootSymbol() const
Get the parent symbol that does not have another parent.
const BOX2I GetUnitBoundingBox(int aUnit, int aConvert, bool aIgnoreHiddenFields=true) const
Get the bounding box for the symbol.
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.
static int * SubpartIdSeparatorPtr()
Return a reference to m_subpartIdSeparator, only for read/save setting functions.
wxString GetDescription() override
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.
virtual wxString GetClass() const override
Return the class name.
LIB_ID m_sourceLibId
For database library symbols; the original symbol.
void AddField(LIB_FIELD &aField)
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.
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
SYMBOL_LIB * GetLib() const
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
int GetPinCount() override
void SetLibId(const LIB_ID &aLibId)
bool HasConversion() const
Test if symbol has more than one body conversion type (DeMorgan).
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed)
Print symbol.
LIB_SYMBOL_REF & GetParent()
LIB_PIN * GetPin(const wxString &aNumber, int aUnit=0, int aConvert=0) const
Return pin object with the requested pin aNumber.
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.
bool ShowPinNumbers() const
static int * SubpartFirstIdPtr()
Return a reference to m_subpartFirstId, only for read/save setting functions.
void SetExcludedFromSim(bool aExcludeFromSim)
Set or clear the exclude from simulation flag.
const LIB_ITEMS_CONTAINER & GetDrawItems() const
bool GetExcludedFromBoard() const
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.
size_t size(int aType=UNDEFINED_TYPE) const
boost::ptr_vector< LIB_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.
Object used to load, save, search, and otherwise manipulate symbol library files.
const INSPECTOR_FUNC & INSPECTOR
TRANSFORM DefaultTransform
uint32_t timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
MULTIVECTOR< LIB_ITEM, LIB_SHAPE_T, LIB_FIELD_T > LIB_ITEMS_CONTAINER
std::weak_ptr< LIB_SYMBOL > LIB_SYMBOL_REF
weak pointer to LIB_SYMBOL
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)
std::vector< LIB_ITEM * > m_items
The items unique to this unit and alternate body style.
int m_convert
The alternate body style of the unit.
int m_unit
The unit number.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.