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 1254 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().

1255 {
1256  // Try the single or no- layer case (easy)
1257  PCB_LAYER_ID layer = aMask.ExtractLayer();
1258 
1259  switch( (int) layer )
1260  {
1261  case UNSELECTED_LAYER:
1262  return _( "No layers" );
1263 
1264  case UNDEFINED_LAYER:
1265  break;
1266 
1267  default:
1268  return aBoard->GetLayerName( layer );
1269  }
1270 
1271  // Try to be smart and useful, starting with outer copper
1272  // (which are more important than internal ones)
1273  wxString layerInfo;
1274 
1275  if( aMask[F_Cu] )
1276  AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
1277 
1278  if( aMask[B_Cu] )
1279  AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
1280 
1281  if( ( aMask & LSET::InternalCuMask() ).any() )
1282  AccumulateDescription( layerInfo, _("Internal" ) );
1283 
1284  if( ( aMask & LSET::AllNonCuMask() ).any() )
1285  AccumulateDescription( layerInfo, _("Non-copper" ) );
1286 
1287  return layerInfo;
1288 }
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