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

1411 {
1412  // Try to be smart and useful. Check all copper first.
1413  if( aMask[F_Cu] && aMask[B_Cu] )
1414  return _( "All copper layers" );
1415 
1416  // Check for copper.
1417  auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
1418 
1419  for( int i = 0; i < 2; i++ )
1420  {
1422  {
1423  if( layer[ bit ] )
1424  {
1425  wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
1426 
1427  if( aMask.count() > 1 )
1428  layerInfo << _( " and others" );
1429 
1430  return layerInfo;
1431  }
1432  }
1433 
1434  // No copper; check for technicals.
1435  layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
1436  }
1437 
1438  // No copper, no technicals: no layer
1439  return _( "no layers" );
1440 }
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().