KiCad PCB EDA Suite
DIALOG_NET_INSPECTOR::DATA_MODEL Class Reference
Inheritance diagram for DIALOG_NET_INSPECTOR::DATA_MODEL:

Public Member Functions

 DATA_MODEL (DIALOG_NET_INSPECTOR &parent)
 
unsigned int columnCount () const
 
unsigned int itemCount () const
 
wxVariant valueAt (unsigned int aCol, unsigned int aRow) const
 
const LIST_ITEMitemAt (unsigned int aRow) const
 
OPT< LIST_ITEM_ITERfindItem (int aNetCode)
 
OPT< LIST_ITEM_ITERfindItem (NETINFO_ITEM *aNet)
 
OPT< LIST_ITEM_ITERaddItem (std::unique_ptr< LIST_ITEM > aItem)
 
void addItems (std::vector< std::unique_ptr< LIST_ITEM >> &&aItems)
 
std::unique_ptr< LIST_ITEMdeleteItem (const OPT< LIST_ITEM_ITER > &aRow)
 
void deleteAllItems ()
 
void updateItem (const OPT< LIST_ITEM_ITER > &aRow)
 
void updateAllItems ()
 
void resortIfChanged (LIST_ITEM *aItem)
 
bool itemColumnChanged (const LIST_ITEM *aItem, unsigned int aCol) const
 

Static Public Member Functions

static const auto & columnDesc ()
 

Protected Member Functions

unsigned int GetColumnCount () const override
 
void GetValue (wxVariant &aOutValue, const wxDataViewItem &aItem, unsigned int aCol) const override
 
int Compare (const wxDataViewItem &aItem1, const wxDataViewItem &aItem2, unsigned int aCol, bool aAsc) const override
 
bool SetValue (const wxVariant &aInValue, const wxDataViewItem &aItem, unsigned int aCol) override
 
wxDataViewItem GetParent (const wxDataViewItem &aItem) const override
 
bool IsContainer (const wxDataViewItem &aItem) const override
 
bool HasContainerColumns (const wxDataViewItem &aItem) const override
 
unsigned int GetChildren (const wxDataViewItem &aParent, wxDataViewItemArray &aChildren) const override
 
wxString GetColumnType (unsigned int) const override
 

Static Protected Member Functions

static int compareUInt (uint64_t aValue1, uint64_t aValue2, bool aAsc)
 

Private Attributes

DIALOG_NET_INSPECTORm_parent
 
std::vector< std::unique_ptr< LIST_ITEM > > m_items
 

Detailed Description

Definition at line 271 of file dialog_net_inspector.cpp.

Constructor & Destructor Documentation

◆ DATA_MODEL()

DIALOG_NET_INSPECTOR::DATA_MODEL::DATA_MODEL ( DIALOG_NET_INSPECTOR parent)
inline

Definition at line 298 of file dialog_net_inspector.cpp.

298  : m_parent( parent )
299  {
300  }

Member Function Documentation

◆ addItem()

OPT<LIST_ITEM_ITER> DIALOG_NET_INSPECTOR::DATA_MODEL::addItem ( std::unique_ptr< LIST_ITEM aItem)
inline

Definition at line 343 of file dialog_net_inspector.cpp.

344  {
345  if( aItem == nullptr )
346  return {};
347 
348  // make sure that the vector is always sorted. usually when new nets are added,
349  // they always get a higher netcode number than the already existing ones.
350  // however, if we've got filtering enabled, we might not have all the nets in
351  // our list, so do a sorted insertion.
352 
353  auto new_iter = std::lower_bound( m_items.begin(), m_items.end(), aItem->GetNetCode(),
354  LIST_ITEM_NETCODE_CMP_LESS() );
355 
356  new_iter = m_items.insert( new_iter, std::move( aItem ) );
357  const std::unique_ptr<LIST_ITEM>& new_item = *new_iter;
358 
359  if( m_parent.m_groupBy->IsChecked()
360  && ( m_parent.m_groupByKind->GetSelection() == 0
361  || m_parent.m_groupByKind->GetSelection() == 1 ) )
362  {
363  for( unsigned int j = 0; j < m_parent.m_groupFilter.size(); ++j )
364  {
365  if( m_parent.m_groupFilter[j]->Find( new_item->GetNetName() ) )
366  {
367  new_item->SetParent( &*m_items[j] );
368  break;
369  }
370  }
371  }
372  else if( m_parent.m_groupBy->IsChecked()
373  && ( m_parent.m_groupByKind->GetSelection() == 2
374  || m_parent.m_groupByKind->GetSelection() == 3 ) )
375  {
376  auto groups_begin = m_items.begin();
377  auto groups_end = std::find_if_not( m_items.begin(), m_items.end(),
378  []( const std::unique_ptr<LIST_ITEM>& x )
379  {
380  return x->GetIsGroup();
381  } );
382 
383  for( std::unique_ptr<EDA_PATTERN_MATCH>& f : m_parent.m_groupFilter )
384  {
385  EDA_PATTERN_MATCH::FIND_RESULT match = f->Find( new_item->GetNetName() );
386 
387  if( match )
388  {
389  wxString match_str = new_item->GetNetName().substr( match.start, match.length );
390 
391  auto group = std::find_if( groups_begin, groups_end,
392  [&]( const std::unique_ptr<LIST_ITEM>& x )
393  {
394  return x->GetNetName() == match_str;
395  } );
396 
397  if( group == groups_end )
398  {
399  int dist = std::distance( groups_end, groups_begin );
400  group = m_items.insert( groups_end,
401  std::make_unique<LIST_ITEM>( dist, match_str ) );
402 
403  groups_end = group + 1;
404 
405  ItemAdded( wxDataViewItem(( *group )->Parent() ),
406  wxDataViewItem( &**group ) );
407  }
408 
409  new_item->SetParent( &**group );
410  break;
411  }
412  }
413  }
414 
415  ItemAdded( wxDataViewItem( new_item->Parent() ), wxDataViewItem( new_item.get() ) );
416 
417  return { new_iter };
418  }
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_groupFilter
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References distance(), group, EDA_PATTERN_MATCH::FIND_RESULT::length, DIALOG_NET_INSPECTOR_BASE::m_groupBy, DIALOG_NET_INSPECTOR_BASE::m_groupByKind, DIALOG_NET_INSPECTOR::m_groupFilter, m_items, m_parent, and EDA_PATTERN_MATCH::FIND_RESULT::start.

Referenced by addItems().

◆ addItems()

void DIALOG_NET_INSPECTOR::DATA_MODEL::addItems ( std::vector< std::unique_ptr< LIST_ITEM >> &&  aItems)
inline

Definition at line 420 of file dialog_net_inspector.cpp.

421  {
422  if( m_items.empty() )
423  {
424  m_items = std::move( aItems );
425 
426  if( m_parent.m_groupBy->IsChecked()
427  && ( m_parent.m_groupByKind->GetSelection() == 0
428  || m_parent.m_groupByKind->GetSelection() == 1 ) )
429  {
430  // assume that there are fewer group filters than nets.
431  // walk over the list items and assign them to groups. note that the
432  // first items are group items themselves, so start after those.
433  for( unsigned int i = m_parent.m_groupFilter.size(); i < m_items.size(); ++i )
434  {
435  for( unsigned int j = 0; j < m_parent.m_groupFilter.size(); ++j )
436  {
437  if( m_parent.m_groupFilter[j]->Find( m_items[ i ]->GetNetName() ) )
438  {
439  m_items[i]->SetParent( &*m_items[j] );
440  break;
441  }
442  }
443  }
444  }
445  else if( m_parent.m_groupBy->IsChecked()
446  && ( m_parent.m_groupByKind->GetSelection() == 2
447  || m_parent.m_groupByKind->GetSelection() == 3 ) )
448  {
449  // assume that there will be fewer resulting groups than nets.
450  // dynamically generate groups for the actual strings of the match result.
451  // try out each filter on each item and group by the resulting substrings.
452  std::vector<std::unique_ptr<LIST_ITEM>> groups;
453 
454  for( std::unique_ptr<LIST_ITEM>& i : m_items )
455  {
456  for( std::unique_ptr<EDA_PATTERN_MATCH>& f : m_parent.m_groupFilter )
457  {
458  EDA_PATTERN_MATCH::FIND_RESULT match = f->Find( i->GetNetName() );
459 
460  if( match )
461  {
462  wxString match_str = i->GetNetName().substr( match.start, match.length );
463 
464  auto group = std::find_if( groups.begin(), groups.end(),
465  [&]( const std::unique_ptr<LIST_ITEM>& x )
466  {
467  return x->GetNetName() == match_str;
468  } );
469 
470  if( group == groups.end() )
471  {
472  groups.emplace_back( std::make_unique<LIST_ITEM>( groups.size(),
473  match_str ) );
474  group = groups.end() - 1;
475  }
476 
477  i->SetParent( &**group );
478  break;
479  }
480  }
481  }
482 
483  // insert the group items at the front of the items list.
484  for( std::unique_ptr<LIST_ITEM>& g : groups )
485  m_items.emplace_back( std::move( g ) );
486 
487  std::rotate( m_items.begin(), m_items.end() - groups.size(), m_items.end() );
488  }
489 
490  for( std::unique_ptr<LIST_ITEM>& i : m_items )
491  ItemAdded( wxDataViewItem( i->Parent() ), wxDataViewItem( &*i ) );
492  }
493  else
494  {
495  m_items.reserve( m_items.size() + aItems.size() );
496 
497  for( std::unique_ptr<LIST_ITEM>& i : aItems )
498  addItem( std::move( i ) );
499  }
500  }
OPT< LIST_ITEM_ITER > addItem(std::unique_ptr< LIST_ITEM > aItem)
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_groupFilter
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References addItem(), group, EDA_PATTERN_MATCH::FIND_RESULT::length, DIALOG_NET_INSPECTOR_BASE::m_groupBy, DIALOG_NET_INSPECTOR_BASE::m_groupByKind, DIALOG_NET_INSPECTOR::m_groupFilter, m_items, m_parent, and EDA_PATTERN_MATCH::FIND_RESULT::start.

◆ columnCount()

unsigned int DIALOG_NET_INSPECTOR::DATA_MODEL::columnCount ( ) const
inline

Definition at line 302 of file dialog_net_inspector.cpp.

303  {
304  return columnDesc().size();
305  }

References columnDesc().

Referenced by GetColumnCount().

◆ columnDesc()

static const auto& DIALOG_NET_INSPECTOR::DATA_MODEL::columnDesc ( )
inlinestatic

Definition at line 283 of file dialog_net_inspector.cpp.

284  {
285  static const std::array<COLUMN_DESC, 8> r =
286  { { COLUMN_NET,
287  COLUMN_NAME,
294 
295  return r;
296  }
static const COLUMN_DESC COLUMN_CHIP_LENGTH
static const COLUMN_DESC COLUMN_NET
static const COLUMN_DESC COLUMN_TOTAL_LENGTH
static const COLUMN_DESC COLUMN_PAD_COUNT
static const COLUMN_DESC COLUMN_NAME
static const COLUMN_DESC COLUMN_BOARD_LENGTH
E_SERIE r
Definition: eserie.cpp:41
static const COLUMN_DESC COLUMN_VIA_LENGTH
static const COLUMN_DESC COLUMN_VIA_COUNT

References DIALOG_NET_INSPECTOR::COLUMN_BOARD_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_CHIP_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_NAME, DIALOG_NET_INSPECTOR::COLUMN_NET, DIALOG_NET_INSPECTOR::COLUMN_PAD_COUNT, DIALOG_NET_INSPECTOR::COLUMN_TOTAL_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_VIA_COUNT, DIALOG_NET_INSPECTOR::COLUMN_VIA_LENGTH, and r.

Referenced by columnCount(), and itemColumnChanged().

◆ Compare()

int DIALOG_NET_INSPECTOR::DATA_MODEL::Compare ( const wxDataViewItem &  aItem1,
const wxDataViewItem &  aItem2,
unsigned int  aCol,
bool  aAsc 
) const
inlineoverrideprotected

Definition at line 665 of file dialog_net_inspector.cpp.

667  {
668  const LIST_ITEM& i1 = *static_cast<const LIST_ITEM*>( aItem1.GetID() );
669  const LIST_ITEM& i2 = *static_cast<const LIST_ITEM*>( aItem2.GetID() );
670 
671  if( i1.GetIsGroup() && !i2.GetIsGroup() )
672  return -1;
673 
674  if( i2.GetIsGroup() && !i1.GetIsGroup() )
675  return 1;
676 
677  if( aCol == COLUMN_NET && i1.GetNetCode() != i2.GetNetCode() )
678  {
679  return aAsc ? ( i2.GetNetCode() - i1.GetNetCode() ) : ( i1.GetNetCode() - i2.GetNetCode() );
680  }
681  else if( aCol == COLUMN_NAME )
682  {
683  const wxString& s1 = i1.GetNetName();
684  const wxString& s2 = i2.GetNetName();
685 
686  int res = aAsc ? s1.Cmp( s2 ) : s2.Cmp( s1 );
687 
688  if( res != 0 )
689  return res;
690  }
691 
692  else if( aCol == COLUMN_PAD_COUNT && i1.GetPadCount() != i2.GetPadCount() )
693  return compareUInt( i1.GetPadCount(), i2.GetPadCount(), aAsc );
694 
695  else if( aCol == COLUMN_VIA_COUNT && i1.GetViaCount() != i2.GetViaCount() )
696  return compareUInt( i1.GetViaCount(), i2.GetViaCount(), aAsc );
697 
698  else if( aCol == COLUMN_VIA_LENGTH && i1.GetViaLength() != i2.GetViaLength() )
699  return compareUInt( i1.GetViaLength(), i2.GetViaLength(), aAsc );
700 
701  else if( aCol == COLUMN_BOARD_LENGTH && i1.GetBoardWireLength() != i2.GetBoardWireLength() )
702  return compareUInt( i1.GetBoardWireLength(), i2.GetBoardWireLength(), aAsc );
703 
704  else if( aCol == COLUMN_CHIP_LENGTH && i1.GetChipWireLength() != i2.GetChipWireLength() )
705  return compareUInt( i1.GetChipWireLength(), i2.GetChipWireLength(), aAsc );
706 
707  else if( aCol == COLUMN_TOTAL_LENGTH && i1.GetTotalLength() != i2.GetTotalLength() )
708  return compareUInt( i1.GetTotalLength(), i2.GetTotalLength(), aAsc );
709 
710  // when the item values compare equal resort to pointer comparison.
711  wxUIntPtr id1 = wxPtrToUInt( aItem1.GetID() );
712  wxUIntPtr id2 = wxPtrToUInt( aItem2.GetID() );
713 
714  return aAsc ? id1 - id2 : id2 - id1;
715  }
static const COLUMN_DESC COLUMN_CHIP_LENGTH
static const COLUMN_DESC COLUMN_NET
static const COLUMN_DESC COLUMN_TOTAL_LENGTH
static const COLUMN_DESC COLUMN_PAD_COUNT
static const COLUMN_DESC COLUMN_NAME
static const COLUMN_DESC COLUMN_BOARD_LENGTH
static const COLUMN_DESC COLUMN_VIA_LENGTH
static const COLUMN_DESC COLUMN_VIA_COUNT
static int compareUInt(uint64_t aValue1, uint64_t aValue2, bool aAsc)

References DIALOG_NET_INSPECTOR::COLUMN_BOARD_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_CHIP_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_NAME, DIALOG_NET_INSPECTOR::COLUMN_NET, DIALOG_NET_INSPECTOR::COLUMN_PAD_COUNT, DIALOG_NET_INSPECTOR::COLUMN_TOTAL_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_VIA_COUNT, DIALOG_NET_INSPECTOR::COLUMN_VIA_LENGTH, compareUInt(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetIsGroup(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetNetCode(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetNetName(), and DIALOG_NET_INSPECTOR::LIST_ITEM::GetTotalLength().

◆ compareUInt()

static int DIALOG_NET_INSPECTOR::DATA_MODEL::compareUInt ( uint64_t  aValue1,
uint64_t  aValue2,
bool  aAsc 
)
inlinestaticprotected

Definition at line 657 of file dialog_net_inspector.cpp.

658  {
659  if( aAsc )
660  return aValue1 < aValue2 ? -1 : 1;
661  else
662  return aValue2 < aValue1 ? -1 : 1;
663  }

Referenced by Compare().

◆ deleteAllItems()

void DIALOG_NET_INSPECTOR::DATA_MODEL::deleteAllItems ( )
inline

Definition at line 542 of file dialog_net_inspector.cpp.

543  {
544  BeforeReset();
545  m_items.clear();
546  AfterReset();
547  }
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References m_items.

◆ deleteItem()

std::unique_ptr<LIST_ITEM> DIALOG_NET_INSPECTOR::DATA_MODEL::deleteItem ( const OPT< LIST_ITEM_ITER > &  aRow)
inline

Definition at line 502 of file dialog_net_inspector.cpp.

503  {
504  if( !aRow )
505  return {};
506 
507  std::unique_ptr<LIST_ITEM> i = std::move( **aRow );
508 
509  // if the row has a parent, detach it first
510  LIST_ITEM* parent = i->Parent();
511  i->SetParent( nullptr );
512 
513  m_items.erase( *aRow );
514  ItemDeleted( wxDataViewItem( parent ), wxDataViewItem( &*i ) );
515 
516  if( parent )
517  {
518  ItemChanged( wxDataViewItem( parent ) );
519 
520  // for grouping type 2,3 a group item might disappear if it becomes empty.
521  if( ( m_parent.m_groupByKind->GetSelection() == 2
522  || m_parent.m_groupByKind->GetSelection() == 3 )
523  && parent != nullptr && parent->ChildrenCount() == 0 )
524  {
525  auto p = std::find_if( m_items.begin(), m_items.end(),
526  [&]( std::unique_ptr<LIST_ITEM>& x )
527  {
528  return x.get() == parent;
529  } );
530 
531  wxASSERT( p != m_items.end() );
532  m_items.erase( p );
533 
534  ItemDeleted( wxDataViewItem( parent->Parent() ), wxDataViewItem( parent ) );
535  }
536  }
537 
538  Resort();
539  return i;
540  }
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenCount(), DIALOG_NET_INSPECTOR_BASE::m_groupByKind, m_items, m_parent, DIALOG_NET_INSPECTOR::LIST_ITEM::Parent(), and DIALOG_NET_INSPECTOR::LIST_ITEM::SetParent().

◆ findItem() [1/2]

OPT<LIST_ITEM_ITER> DIALOG_NET_INSPECTOR::DATA_MODEL::findItem ( int  aNetCode)
inline

Definition at line 324 of file dialog_net_inspector.cpp.

325  {
326  auto i = std::lower_bound(
327  m_items.begin(), m_items.end(), aNetCode, LIST_ITEM_NETCODE_CMP_LESS() );
328 
329  if( i == m_items.end() || ( *i )->GetNetCode() != aNetCode )
330  return {};
331 
332  return { i };
333  }
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References m_items.

Referenced by findItem().

◆ findItem() [2/2]

OPT<LIST_ITEM_ITER> DIALOG_NET_INSPECTOR::DATA_MODEL::findItem ( NETINFO_ITEM aNet)
inline

Definition at line 335 of file dialog_net_inspector.cpp.

336  {
337  if( aNet != nullptr )
338  return findItem( aNet->GetNetCode() );
339  else
340  return {};
341  }
OPT< LIST_ITEM_ITER > findItem(int aNetCode)
int GetNetCode() const
Definition: netinfo.h:115

References findItem(), and NETINFO_ITEM::GetNetCode().

◆ GetChildren()

unsigned int DIALOG_NET_INSPECTOR::DATA_MODEL::GetChildren ( const wxDataViewItem &  aParent,
wxDataViewItemArray &  aChildren 
) const
inlineoverrideprotected

Definition at line 744 of file dialog_net_inspector.cpp.

746  {
747  const LIST_ITEM* p = static_cast<const LIST_ITEM*>( aParent.GetID() );
748 
749  if( !aParent.IsOk() )
750  {
751  aChildren.Alloc( m_items.size() );
752 
753  for( const std::unique_ptr<LIST_ITEM>& i : m_items )
754  {
755  if( i->Parent() == nullptr )
756  aChildren.Add( wxDataViewItem( &*i ) );
757  }
758 
759  return aChildren.GetCount();
760  }
761  else if( p->GetIsGroup() )
762  {
763  const int count = p->ChildrenCount();
764 
765  if( count == 0 )
766  return 0;
767 
768  aChildren.Alloc( count );
769 
770  for( auto i = p->ChildrenBegin(), end = p->ChildrenEnd(); i != end; ++i )
771  aChildren.Add( wxDataViewItem( *i ) );
772 
773  return aChildren.GetCount();
774  }
775 
776  return 0;
777  }
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenBegin(), DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenCount(), DIALOG_NET_INSPECTOR::LIST_ITEM::ChildrenEnd(), DIALOG_NET_INSPECTOR::LIST_ITEM::GetIsGroup(), and m_items.

◆ GetColumnCount()

unsigned int DIALOG_NET_INSPECTOR::DATA_MODEL::GetColumnCount ( ) const
inlineoverrideprotected

Definition at line 618 of file dialog_net_inspector.cpp.

619  {
620  return columnCount();
621  }

References columnCount().

◆ GetColumnType()

wxString DIALOG_NET_INSPECTOR::DATA_MODEL::GetColumnType ( unsigned int  ) const
inlineoverrideprotected

Definition at line 779 of file dialog_net_inspector.cpp.

780  {
781  return wxS( "string" );
782  }

◆ GetParent()

wxDataViewItem DIALOG_NET_INSPECTOR::DATA_MODEL::GetParent ( const wxDataViewItem &  aItem) const
inlineoverrideprotected

Definition at line 723 of file dialog_net_inspector.cpp.

724  {
725  if( !aItem.IsOk() )
726  return wxDataViewItem();
727 
728  return wxDataViewItem( static_cast<const LIST_ITEM*>( aItem.GetID() )->Parent() );
729  }

◆ GetValue()

void DIALOG_NET_INSPECTOR::DATA_MODEL::GetValue ( wxVariant &  aOutValue,
const wxDataViewItem &  aItem,
unsigned int  aCol 
) const
inlineoverrideprotected

Definition at line 623 of file dialog_net_inspector.cpp.

625  {
626  if( LIST_ITEM* i = static_cast<LIST_ITEM*>( aItem.GetID() ) )
627  {
628  if( aCol == COLUMN_NET && !i->GetIsGroup() )
629  aOutValue = m_parent.formatNetCode( i->GetNet() );
630 
631  else if( aCol == COLUMN_NET && i->GetIsGroup() )
632  aOutValue = "";
633 
634  else if( aCol == COLUMN_NAME )
635  aOutValue = i->GetNetName();
636 
637  else if( aCol == COLUMN_PAD_COUNT )
638  aOutValue = m_parent.formatCount( i->GetPadCount() );
639 
640  else if( aCol == COLUMN_VIA_COUNT )
641  aOutValue = m_parent.formatCount( i->GetViaCount() );
642 
643  else if( aCol == COLUMN_VIA_LENGTH )
644  aOutValue = m_parent.formatLength( i->GetViaLength() );
645 
646  else if( aCol == COLUMN_BOARD_LENGTH )
647  aOutValue = m_parent.formatLength( i->GetBoardWireLength() );
648 
649  else if( aCol == COLUMN_CHIP_LENGTH )
650  aOutValue = m_parent.formatLength( i->GetChipWireLength() );
651 
652  else if( aCol == COLUMN_TOTAL_LENGTH )
653  aOutValue = m_parent.formatLength( i->GetTotalLength() );
654  }
655  }
static const COLUMN_DESC COLUMN_CHIP_LENGTH
static const COLUMN_DESC COLUMN_NET
wxString formatCount(unsigned int aValue) const
static const COLUMN_DESC COLUMN_TOTAL_LENGTH
static const COLUMN_DESC COLUMN_PAD_COUNT
static const COLUMN_DESC COLUMN_NAME
static const COLUMN_DESC COLUMN_BOARD_LENGTH
wxString formatLength(int64_t aValue) const
static const COLUMN_DESC COLUMN_VIA_LENGTH
static const COLUMN_DESC COLUMN_VIA_COUNT
wxString formatNetCode(const NETINFO_ITEM *aNet) const

References DIALOG_NET_INSPECTOR::COLUMN_BOARD_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_CHIP_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_NAME, DIALOG_NET_INSPECTOR::COLUMN_NET, DIALOG_NET_INSPECTOR::COLUMN_PAD_COUNT, DIALOG_NET_INSPECTOR::COLUMN_TOTAL_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_VIA_COUNT, DIALOG_NET_INSPECTOR::COLUMN_VIA_LENGTH, DIALOG_NET_INSPECTOR::formatCount(), DIALOG_NET_INSPECTOR::formatLength(), DIALOG_NET_INSPECTOR::formatNetCode(), and m_parent.

Referenced by valueAt().

◆ HasContainerColumns()

bool DIALOG_NET_INSPECTOR::DATA_MODEL::HasContainerColumns ( const wxDataViewItem &  aItem) const
inlineoverrideprotected

Definition at line 739 of file dialog_net_inspector.cpp.

740  {
741  return IsContainer( aItem );
742  }
bool IsContainer(const wxDataViewItem &aItem) const override

References IsContainer().

◆ IsContainer()

bool DIALOG_NET_INSPECTOR::DATA_MODEL::IsContainer ( const wxDataViewItem &  aItem) const
inlineoverrideprotected

Definition at line 731 of file dialog_net_inspector.cpp.

732  {
733  if( !aItem.IsOk() )
734  return true;
735 
736  return static_cast<const LIST_ITEM*>( aItem.GetID() )->GetIsGroup();
737  }

Referenced by HasContainerColumns().

◆ itemAt()

const LIST_ITEM& DIALOG_NET_INSPECTOR::DATA_MODEL::itemAt ( unsigned int  aRow) const
inline

Definition at line 319 of file dialog_net_inspector.cpp.

320  {
321  return *m_items.at( aRow );
322  }
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References m_items.

◆ itemColumnChanged()

bool DIALOG_NET_INSPECTOR::DATA_MODEL::itemColumnChanged ( const LIST_ITEM aItem,
unsigned int  aCol 
) const
inline

Definition at line 586 of file dialog_net_inspector.cpp.

587  {
588  if( aItem == nullptr || aCol >= columnDesc().size() )
589  return false;
590 
591  if( aCol == COLUMN_PAD_COUNT )
592  return aItem->PadCountChanged();
593 
594  else if( aCol == COLUMN_VIA_COUNT )
595  return aItem->ViaCountChanged();
596 
597  else if( aCol == COLUMN_VIA_LENGTH )
598  return aItem->ViaLengthChanged();
599 
600  else if( aCol == COLUMN_BOARD_LENGTH )
601  return aItem->BoardWireLengthChanged();
602 
603  else if( aCol == COLUMN_CHIP_LENGTH )
604  return aItem->ChipWireLengthChanged();
605 
606  else if( aCol == COLUMN_TOTAL_LENGTH )
607  return aItem->TotalLengthChanged();
608 
609  return false;
610  }
static const COLUMN_DESC COLUMN_CHIP_LENGTH
static const COLUMN_DESC COLUMN_TOTAL_LENGTH
static const COLUMN_DESC COLUMN_PAD_COUNT
static const COLUMN_DESC COLUMN_BOARD_LENGTH
static const COLUMN_DESC COLUMN_VIA_LENGTH
static const COLUMN_DESC COLUMN_VIA_COUNT

References DIALOG_NET_INSPECTOR::COLUMN_BOARD_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_CHIP_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_PAD_COUNT, DIALOG_NET_INSPECTOR::COLUMN_TOTAL_LENGTH, DIALOG_NET_INSPECTOR::COLUMN_VIA_COUNT, DIALOG_NET_INSPECTOR::COLUMN_VIA_LENGTH, columnDesc(), and DIALOG_NET_INSPECTOR::LIST_ITEM::TotalLengthChanged().

Referenced by resortIfChanged().

◆ itemCount()

unsigned int DIALOG_NET_INSPECTOR::DATA_MODEL::itemCount ( ) const
inline

Definition at line 307 of file dialog_net_inspector.cpp.

308  {
309  return m_items.size();
310  }
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References m_items.

◆ resortIfChanged()

void DIALOG_NET_INSPECTOR::DATA_MODEL::resortIfChanged ( LIST_ITEM aItem)
inline

Definition at line 569 of file dialog_net_inspector.cpp.

570  {
571  if( wxDataViewColumn* column = m_parent.m_netsList->GetSortingColumn() )
572  {
573  bool changed = false;
574 
575  for( const LIST_ITEM* i = aItem; i != nullptr; i = i->Parent() )
576  changed |= itemColumnChanged( i, column->GetModelColumn() );
577 
578  for( LIST_ITEM* i = aItem; i != nullptr; i = i->Parent() )
579  i->ResetColumnChangedBits();
580 
581  if( changed )
582  Resort();
583  }
584  }
bool itemColumnChanged(const LIST_ITEM *aItem, unsigned int aCol) const

References itemColumnChanged(), DIALOG_NET_INSPECTOR_BASE::m_netsList, m_parent, and DIALOG_NET_INSPECTOR::LIST_ITEM::Parent().

Referenced by updateItem().

◆ SetValue()

bool DIALOG_NET_INSPECTOR::DATA_MODEL::SetValue ( const wxVariant &  aInValue,
const wxDataViewItem &  aItem,
unsigned int  aCol 
)
inlineoverrideprotected

Definition at line 717 of file dialog_net_inspector.cpp.

719  {
720  return false;
721  }

◆ updateAllItems()

void DIALOG_NET_INSPECTOR::DATA_MODEL::updateAllItems ( )
inline

Definition at line 563 of file dialog_net_inspector.cpp.

564  {
565  for( std::unique_ptr<LIST_ITEM>& i : m_items )
566  ItemChanged( wxDataViewItem( i.get() ) );
567  }
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References m_items.

◆ updateItem()

void DIALOG_NET_INSPECTOR::DATA_MODEL::updateItem ( const OPT< LIST_ITEM_ITER > &  aRow)
inline

Definition at line 549 of file dialog_net_inspector.cpp.

550  {
551  if( aRow )
552  {
553  const std::unique_ptr<LIST_ITEM>& listItem = *aRow.get();
554 
555  if( listItem->Parent() )
556  ItemChanged( wxDataViewItem( listItem->Parent() ) );
557 
558  ItemChanged( wxDataViewItem( listItem.get() ) );
559  resortIfChanged( listItem.get() );
560  }
561  }

References resortIfChanged().

◆ valueAt()

wxVariant DIALOG_NET_INSPECTOR::DATA_MODEL::valueAt ( unsigned int  aCol,
unsigned int  aRow 
) const
inline

Definition at line 312 of file dialog_net_inspector.cpp.

313  {
314  wxVariant r;
315  GetValue( r, wxDataViewItem( const_cast<LIST_ITEM*>( &*( m_items[aRow] ) ) ), aCol );
316  return r;
317  }
E_SERIE r
Definition: eserie.cpp:41
void GetValue(wxVariant &aOutValue, const wxDataViewItem &aItem, unsigned int aCol) const override
std::vector< std::unique_ptr< LIST_ITEM > > m_items

References GetValue(), m_items, and r.

Member Data Documentation

◆ m_items

std::vector<std::unique_ptr<LIST_ITEM> > DIALOG_NET_INSPECTOR::DATA_MODEL::m_items
private

◆ m_parent

DIALOG_NET_INSPECTOR& DIALOG_NET_INSPECTOR::DATA_MODEL::m_parent
private

Definition at line 274 of file dialog_net_inspector.cpp.

Referenced by addItem(), addItems(), deleteItem(), GetValue(), and resortIfChanged().


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