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 <geometry/geometry_utils.h>
#include <pcbnew.h>
#include <view/view.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 1434 of file class_pad.cpp.

1435 {
1436  // Try to be smart and useful. Check all copper first.
1437  if( aMask[F_Cu] && aMask[B_Cu] )
1438  return _( "All copper layers" );
1439 
1440  // Check for copper.
1441  auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
1442 
1443  for( int i = 0; i < 2; i++ )
1444  {
1445  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
1446  {
1447  if( layer[ bit ] )
1448  {
1449  wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
1450 
1451  if( aMask.count() > 1 )
1452  layerInfo << _( " and others" );
1453 
1454  return layerInfo;
1455  }
1456  }
1457 
1458  // No copper; check for technicals.
1459  layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
1460  }
1461 
1462  // No copper, no technicals: no layer
1463  return _( "no layers" );
1464 }
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
#define _(s)
size_t i
Definition: json11.cpp:597

References _, LSET::AllCuMask(), LSET::AllTechMask(), B_Cu, 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().