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

1014 {
1015  // Try the single or no- layer case (easy)
1016  LAYER_ID layer = aMask.ExtractLayer();
1017 
1018  switch( (int) layer )
1019  {
1020  case UNSELECTED_LAYER:
1021  return _( "No layers" );
1022 
1023  case UNDEFINED_LAYER:
1024  break;
1025 
1026  default:
1027  return aBoard->GetLayerName( layer );
1028  }
1029 
1030  // Try to be smart and useful, starting with outer copper
1031  // (which are more important than internal ones)
1032  wxString layerInfo;
1033 
1034  if( aMask[F_Cu] )
1035  AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
1036 
1037  if( aMask[B_Cu] )
1038  AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
1039 
1040  if( ( aMask & LSET::InternalCuMask() ).any() )
1041  AccumulateDescription( layerInfo, _("Internal" ) );
1042 
1043  if( ( aMask & LSET::AllNonCuMask() ).any() )
1044  AccumulateDescription( layerInfo, _("Non-copper" ) );
1045 
1046  return layerInfo;
1047 }
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:661
LAYER_ID ExtractLayer() const
Find the first set LAYER_ID.
Definition: lset.cpp:577
const wxString GetLayerName(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:598
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: macros.h:65
LAYER_ID
Enum LAYER_ID is the set of PCB layers.