KiCad PCB EDA Suite
class_pad.cpp File Reference

D_PAD class implementation. More...

#include <fctsys.h>
#include <trigo.h>
#include <macros.h>
#include <msgpanel.h>
#include <base_units.h>
#include <bitmaps.h>
#include <view/view.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

◆ LayerMaskDescribe()

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 1430 of file class_pad.cpp.

1431 {
1432  // Try to be smart and useful. Check all copper first.
1433  if( aMask[F_Cu] && aMask[B_Cu] )
1434  return _( "All copper layers" );
1435 
1436  // Check for copper.
1437  auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
1438 
1439  for( int i = 0; i < 2; i++ )
1440  {
1442  {
1443  if( layer[ bit ] )
1444  {
1445  wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
1446 
1447  if( aMask.count() > 1 )
1448  layerInfo << _( " and others" );
1449 
1450  return layerInfo;
1451  }
1452  }
1453 
1454  // No copper; check for technicals.
1455  layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
1456  }
1457 
1458  // No copper, no technicals: no layer
1459  return _( "no layers" );
1460 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:746
size_t i
Definition: json11.cpp:597
static long bit[8][9]
Definition: solve.cpp:826

References LSET::AllCuMask(), LSET::AllTechMask(), B_Cu, bit, F_Cu, BOARD::GetEnabledLayers(), BOARD::GetLayerName(), i, PCB_LAYER_ID_COUNT, and PCBNEW_LAYER_ID_START.

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