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 <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_mire.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.h>

Go to the source code of this file.

Classes

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

Macros

#define FMTIU   BOARD_ITEM::FormatInternalUnits
 

Typedefs

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

Functions

static const wxString traceFootprintLibrary (wxT("KicadFootprintLib"))
 Definition for enabling and disabling footprint library trace output. More...
 
void filterNetClass (const BOARD &aBoard, NETCLASS &aNetClass)
 

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

More...
 

Macro Definition Documentation

#define FMTIU   BOARD_ITEM::FormatInternalUnits

Definition at line 56 of file kicad_plugin.cpp.

Referenced by PCB_IO::format().

Typedef Documentation

typedef MODULE_MAP::const_iterator MODULE_CITER

Definition at line 138 of file kicad_plugin.cpp.

typedef MODULE_MAP::iterator MODULE_ITER

Definition at line 137 of file kicad_plugin.cpp.

typedef boost::ptr_map< std::string, FP_CACHE_ITEM > MODULE_MAP

Definition at line 136 of file kicad_plugin.cpp.

Function Documentation

void filterNetClass ( const BOARD aBoard,
NETCLASS aNetClass 
)

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

Definition at line 65 of file kicad_plugin.cpp.

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

Referenced by PCB_IO::format().

66 {
67  auto connectivity = aBoard.GetConnectivity();
68 
69  for( NETCLASS::iterator it = aNetClass.begin(); it != aNetClass.end(); )
70  {
71  NETINFO_ITEM* netinfo = aBoard.FindNet( *it );
72 
73  if( netinfo && connectivity->GetNodeCount( netinfo->GetNet() ) <= 0 ) // hopefully there are no nets with negative
74  aNetClass.Remove( it++ ); // node count, but you never know..
75  else
76  ++it;
77  }
78 }
iterator begin()
STRINGSET::iterator iterator
iterator end()
int GetNet() const
Function GetNet.
Class NETINFO_ITEM handles the data for a net.
Definition: class_netinfo.h:69
void Remove(iterator aName)
Function Remove will remove NET name aName from the collection of members.
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:290
static const wxString traceFootprintLibrary ( wxT("KicadFootprintLib")  )
static

Definition for enabling and disabling footprint library trace output.

See the wxWidgets documentation on using the WXTRACE environment variable.

Referenced by PCB_IO::FootprintLibDelete(), PCB_IO::FootprintSave(), FP_CACHE_ITEM::IsModified(), FP_CACHE::IsModified(), and FP_CACHE::Save().