KiCad PCB EDA Suite
kicad_plugin.cpp File Reference
#include <fctsys.h>
#include <kicad_string.h>
#include <common.h>
#include <build_version.h>
#include <macros.h>
#include <wildcards_and_files_ext.h>
#include <base_units.h>
#include <trace_helpers.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pcb_text.h>
#include <class_dimension.h>
#include <class_track.h>
#include <class_zone.h>
#include <class_drawsegment.h>
#include <class_pcb_target.h>
#include <class_edge_mod.h>
#include <pcb_plot_params.h>
#include <zones.h>
#include <kicad_plugin.h>
#include <pcb_parser.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
#include <boost/ptr_container/ptr_map.hpp>
#include <memory.h>
#include <connectivity/connectivity_data.h>

Go to the source code of this file.


 Class FP_CACHE_ITEM is helper class for creating a footprint library cache. More...
class  FP_CACHE


#define FMT_IU   BOARD_ITEM::FormatInternalUnits
#define FMT_ANGLE   BOARD_ITEM::FormatAngle


typedef boost::ptr_map< wxString, FP_CACHE_ITEMMODULE_MAP
typedef MODULE_MAP::iterator MODULE_ITER
typedef MODULE_MAP::const_iterator MODULE_CITER


void filterNetClass (const BOARD &aBoard, NETCLASS &aNetClass)

Removes empty nets (i.e. with node count equal zero) from net classes


Macro Definition Documentation

#define FMT_ANGLE   BOARD_ITEM::FormatAngle

Typedef Documentation

typedef MODULE_MAP::const_iterator MODULE_CITER

Definition at line 107 of file kicad_plugin.cpp.

typedef MODULE_MAP::iterator MODULE_ITER

Definition at line 106 of file kicad_plugin.cpp.

typedef boost::ptr_map< wxString, FP_CACHE_ITEM > MODULE_MAP

Definition at line 105 of file kicad_plugin.cpp.

Function Documentation

void filterNetClass ( const BOARD aBoard,

Removes empty nets (i.e. with node count equal zero) from net classes

Definition at line 62 of file kicad_plugin.cpp.

References NETCLASS::begin(), NETCLASS::end(), BOARD::FindNet(), BOARD::GetConnectivity(), NETINFO_ITEM::GetNet(), and NETCLASS::Remove().

Referenced by PCB_IO::formatNetInformation().

63 {
64  auto connectivity = aBoard.GetConnectivity();
66  for( NETCLASS::iterator it = aNetClass.begin(); it != aNetClass.end(); )
67  {
68  NETINFO_ITEM* netinfo = aBoard.FindNet( *it );
70  if( netinfo && connectivity->GetNodeCount( netinfo->GetNet() ) <= 0 ) // hopefully there are no nets with negative
71  aNetClass.Remove( it++ ); // node count, but you never know..
72  else
73  ++it;
74  }
75 }
iterator begin()
Definition: netclass.h:132
STRINGSET::iterator iterator
Definition: netclass.h:131
iterator end()
Definition: netclass.h:133
int GetNet() const
Function GetNet.
Definition: netinfo.h:231
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
void Remove(iterator aName)
Function Remove will remove NET name aName from the collection of members.
Definition: netclass.h:143
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:296