KiCad PCB EDA Suite
class_pad.cpp File Reference

D_PAD class implementation. More...

#include <fctsys.h>
#include <PolyLine.h>
#include <trigo.h>
#include <wxstruct.h>
#include <macros.h>
#include <msgpanel.h>
#include <base_units.h>
#include <bitmaps.h>
#include <pcbnew.h>
#include <class_board.h>
#include <class_module.h>
#include <polygon_test_point_inside.h>
#include <convert_to_biu.h>
#include <convert_basic_shapes_to_polygon.h>

Go to the source code of this file.

Functions

static wxString LayerMaskDescribe (const BOARD *aBoard, LSET aMask)
 Helper function Return a string (to be shown to the user) describing a layer mask. More...
 

Detailed Description

D_PAD class implementation.

Definition in file class_pad.cpp.

Function Documentation

wxString LayerMaskDescribe ( const BOARD aBoard,
LSET  aMask 
)
static

Helper function Return a string (to be shown to the user) describing a layer mask.

Useful for showing where is a pad. The BOARD is needed because layer names are (somewhat) customizable

Definition at line 1299 of file class_pad.cpp.

References AccumulateDescription(), LSET::AllNonCuMask(), B_Cu, LSET::ExtractLayer(), F_Cu, BOARD::GetLayerName(), LSET::InternalCuMask(), UNDEFINED_LAYER, and UNSELECTED_LAYER.

Referenced by D_PAD::GetMsgPanelInfo(), and D_PAD::GetSelectMenuText().

1300 {
1301  // Try the single or no- layer case (easy)
1302  PCB_LAYER_ID layer = aMask.ExtractLayer();
1303 
1304  switch( (int) layer )
1305  {
1306  case UNSELECTED_LAYER:
1307  return _( "No layers" );
1308 
1309  case UNDEFINED_LAYER:
1310  break;
1311 
1312  default:
1313  return aBoard->GetLayerName( layer );
1314  }
1315 
1316  // Try to be smart and useful, starting with outer copper
1317  // (which are more important than internal ones)
1318  wxString layerInfo;
1319 
1320  if( aMask[F_Cu] )
1321  AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
1322 
1323  if( aMask[B_Cu] )
1324  AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
1325 
1326  if( ( aMask & LSET::InternalCuMask() ).any() )
1327  AccumulateDescription( layerInfo, _("Internal" ) );
1328 
1329  if( ( aMask & LSET::AllNonCuMask() ).any() )
1330  AccumulateDescription( layerInfo, _("Non-copper" ) );
1331 
1332  return layerInfo;
1333 }
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:662
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
Definition: lset.cpp:578
PCB_LAYER_ID
A quick note on layer IDs:
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:599
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: macros.h:65