KiCad PCB EDA Suite
Loading...
Searching...
No Matches
LIB_TREE_NODE_ITEM Class Reference

Node type: LIB_ID. More...

#include <lib_tree_model.h>

Inheritance diagram for LIB_TREE_NODE_ITEM:
LIB_TREE_NODE

Public Types

enum class  TYPE {
  ROOT , LIBRARY , ITEM , UNIT ,
  INVALID
}
 
typedef std::vector< std::unique_ptr< LIB_TREE_NODE > > PTR_VECTOR
 

Public Member Functions

 LIB_TREE_NODE_ITEM (LIB_TREE_NODE_ITEM const &_)=delete
 The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be copied around.
 
void operator= (LIB_TREE_NODE_ITEM const &_)=delete
 
 LIB_TREE_NODE_ITEM (LIB_TREE_NODE *aParent, LIB_TREE_ITEM *aItem)
 Construct a LIB_ID node.
 
void Update (LIB_TREE_ITEM *aItem)
 Update the node using data from a LIB_ALIAS object.
 
void UpdateScore (const std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > &aMatchers, std::function< bool(LIB_TREE_NODE &aNode)> *aFilter) override
 Perform the actual search.
 
void RebuildSearchTerms (const std::vector< wxString > &aShownColumns)
 Rebuild search terms from source search terms and shown fields.
 
void AssignIntrinsicRanks (const std::vector< wxString > &aShownColumns, bool presorted=false)
 Store intrinsic ranks on all children of this node.
 
void SortNodes (bool aUseScores)
 Sort child nodes quickly and recursively (IntrinsicRanks must have been set).
 

Static Public Member Functions

static bool Compare (LIB_TREE_NODE const &aNode1, LIB_TREE_NODE const &aNode2, bool aUseScores)
 Compare two nodes.
 

Public Attributes

LIB_TREE_NODEm_Parent
 
PTR_VECTOR m_Children
 
enum TYPE m_Type
 
int m_IntrinsicRank
 The rank of the item before any search terms are applied.
 
int m_Score
 
bool m_Pinned
 
wxString m_Name
 
wxString m_Desc
 
wxString m_Footprint
 
int m_PinCount
 
std::vector< SEARCH_TERMm_SearchTerms
 
std::map< wxString, wxString > m_Fields
 List of weighted search terms.
 
LIB_ID m_LibId
 
int m_Unit
 
bool m_IsRoot
 
bool m_IsRecentlyUsedGroup
 
bool m_IsAlreadyPlacedGroup
 

Protected Member Functions

LIB_TREE_NODE_UNITAddUnit (LIB_TREE_ITEM *aItem, int aUnit)
 Add a new unit to the component and return it.
 

Protected Attributes

std::vector< SEARCH_TERMm_sourceSearchTerms
 

Detailed Description

Node type: LIB_ID.

Definition at line 189 of file lib_tree_model.h.

Member Typedef Documentation

◆ PTR_VECTOR

typedef std::vector<std::unique_ptr<LIB_TREE_NODE> > LIB_TREE_NODE::PTR_VECTOR
inherited

Definition at line 120 of file lib_tree_model.h.

Member Enumeration Documentation

◆ TYPE

enum class LIB_TREE_NODE::TYPE
stronginherited
Enumerator
ROOT 
LIBRARY 
ITEM 
UNIT 
INVALID 

Definition at line 111 of file lib_tree_model.h.

Constructor & Destructor Documentation

◆ LIB_TREE_NODE_ITEM() [1/2]

LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM ( LIB_TREE_NODE_ITEM const & _)
delete

The addresses of CMP_TREE_NODEs are used as unique IDs for the wxDataViewModel, so don't let them be copied around.

References _, and LIB_TREE_NODE_ITEM().

Referenced by LIB_TREE_NODE_ITEM(), and operator=().

◆ LIB_TREE_NODE_ITEM() [2/2]

LIB_TREE_NODE_ITEM::LIB_TREE_NODE_ITEM ( LIB_TREE_NODE * aParent,
LIB_TREE_ITEM * aItem )

Construct a LIB_ID node.

All fields will be populated from the LIB_ALIAS, including children (unit nodes will be generated automatically). This does not keep the pointer to the #LIB_ALIAS object because at any time, a #LIB_ALIAS can be remove from a library which will result in an invalid pointer. The alias must be resolved at the time of use. Anything else is a bug.

Parameters
aParentparent node, should be a CMP_TREE_NODE_LIB
aItemLIB_COMPONENT to populate the node.

Definition at line 178 of file lib_tree_model.cpp.

References AddUnit(), LIB_TREE_ITEM::GetChooserFields(), LIB_TREE_ITEM::GetDesc(), LIB_TREE_ITEM::GetFootprint(), LIB_TREE_ITEM::GetLibNickname(), LIB_TREE_ITEM::GetName(), LIB_TREE_ITEM::GetPinCount(), LIB_TREE_ITEM::GetSearchTerms(), LIB_TREE_ITEM::GetSubUnitCount(), LIB_TREE_ITEM::IsRoot(), LIB_TREE_NODE::LIB_TREE_NODE(), LIB_TREE_NODE::m_Desc, LIB_TREE_NODE::m_Fields, LIB_TREE_NODE::m_Footprint, LIB_TREE_NODE::m_IsRoot, LIB_TREE_NODE::m_LibId, LIB_TREE_NODE::m_Name, LIB_TREE_NODE::m_Parent, LIB_TREE_NODE::m_PinCount, LIB_TREE_NODE::m_sourceSearchTerms, and LIB_TREE_NODE::m_Type.

Member Function Documentation

◆ AddUnit()

LIB_TREE_NODE_UNIT & LIB_TREE_NODE_ITEM::AddUnit ( LIB_TREE_ITEM * aItem,
int aUnit )
protected

Add a new unit to the component and return it.

This should not be used directly, as the constructor adds all units.

Definition at line 205 of file lib_tree_model.cpp.

References LIB_TREE_NODE::m_Children.

Referenced by LIB_TREE_NODE_ITEM(), and Update().

◆ AssignIntrinsicRanks()

void LIB_TREE_NODE::AssignIntrinsicRanks ( const std::vector< wxString > & aShownColumns,
bool presorted = false )
inherited

Store intrinsic ranks on all children of this node.

See m_IntrinsicRank member doc for more information.

Definition at line 46 of file lib_tree_model.cpp.

References LIB_TREE_NODE(), m_Children, and m_IntrinsicRank.

Referenced by LIB_TREE_MODEL_ADAPTER::DoAddLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), and SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().

◆ Compare()

bool LIB_TREE_NODE::Compare ( LIB_TREE_NODE const & aNode1,
LIB_TREE_NODE const & aNode2,
bool aUseScores )
staticinherited

Compare two nodes.

Returns true if aNode1 < aNode2.

Definition at line 90 of file lib_tree_model.cpp.

References LIB_TREE_NODE(), m_IntrinsicRank, m_IsRecentlyUsedGroup, m_Name, m_Pinned, m_Score, and m_Type.

◆ operator=()

void LIB_TREE_NODE_ITEM::operator= ( LIB_TREE_NODE_ITEM const & _)
delete

◆ RebuildSearchTerms()

void LIB_TREE_NODE::RebuildSearchTerms ( const std::vector< wxString > & aShownColumns)
inherited

Rebuild search terms from source search terms and shown fields.

Definition at line 34 of file lib_tree_model.cpp.

References alg::contains(), m_Fields, m_SearchTerms, m_sourceSearchTerms, and name.

◆ SortNodes()

void LIB_TREE_NODE::SortNodes ( bool aUseScores)
inherited

Sort child nodes quickly and recursively (IntrinsicRanks must have been set).

Definition at line 77 of file lib_tree_model.cpp.

References m_Children.

◆ Update()

◆ UpdateScore()

void LIB_TREE_NODE_ITEM::UpdateScore ( const std::vector< std::unique_ptr< EDA_COMBINED_MATCHER > > & aMatchers,
std::function< bool(LIB_TREE_NODE &aNode)> * aFilter )
overridevirtual

Perform the actual search.

Implements LIB_TREE_NODE.

Definition at line 233 of file lib_tree_model.cpp.

References LIB_TREE_NODE::LIB_TREE_NODE(), LIB_TREE_NODE::m_Children, LIB_TREE_NODE::m_Score, and LIB_TREE_NODE::m_SearchTerms.

Member Data Documentation

◆ m_Children

◆ m_Desc

◆ m_Fields

std::map<wxString, wxString> LIB_TREE_NODE::m_Fields
inherited

◆ m_Footprint

wxString LIB_TREE_NODE::m_Footprint
inherited

◆ m_IntrinsicRank

int LIB_TREE_NODE::m_IntrinsicRank
inherited

The rank of the item before any search terms are applied.

This is a fairly expensive sort (involving string compares) so it helps to store the result of that sort.

Definition at line 131 of file lib_tree_model.h.

Referenced by AssignIntrinsicRanks(), Compare(), LIB_TREE_NODE(), and LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT().

◆ m_IsAlreadyPlacedGroup

bool LIB_TREE_NODE::m_IsAlreadyPlacedGroup
inherited

Definition at line 149 of file lib_tree_model.h.

Referenced by LIB_TREE_NODE(), and PANEL_SYMBOL_CHOOSER::PANEL_SYMBOL_CHOOSER().

◆ m_IsRecentlyUsedGroup

bool LIB_TREE_NODE::m_IsRecentlyUsedGroup
inherited

◆ m_IsRoot

◆ m_LibId

LIB_ID LIB_TREE_NODE::m_LibId
inherited

◆ m_Name

◆ m_Parent

◆ m_PinCount

int LIB_TREE_NODE::m_PinCount
inherited

◆ m_Pinned

◆ m_Score

◆ m_SearchTerms

std::vector<SEARCH_TERM> LIB_TREE_NODE::m_SearchTerms
inherited

◆ m_sourceSearchTerms

std::vector<SEARCH_TERM> LIB_TREE_NODE::m_sourceSearchTerms
protectedinherited

◆ m_Type

◆ m_Unit


The documentation for this class was generated from the following files: