KiCad PCB EDA Suite
layers_id_colors_and_visibility.h File Reference

Board layer functions and definitions. More...

#include <vector>
#include <bitset>
#include <wx/string.h>
#include <macros.h>

Go to the source code of this file.

Classes

class  LSEQ
 Class LSEQ is a sequence (and therefore also a set) of LAYER_IDs. More...
 
class  LSET
 Class LSET is a set of LAYER_IDs. More...
 

Macros

#define MAX_CU_LAYERS   (B_Cu - F_Cu + 1)
 
#define MIN_VISIBILITY_MASK
 
#define ITEM_GAL_LAYER(layer)   (LAYER_ID_COUNT + layer)
 macro for obtaining layer number for specific item (eg. pad or text) More...
 
#define NETNAMES_GAL_LAYER(layer)   (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + layer )
 
#define TOTAL_LAYER_COUNT   (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + END_NETNAMES_VISIBLE_LIST)
 number of all GAL layers including PCB and item layers More...
 

Typedefs

typedef int LAYER_NUM
 Type LAYER_NUM can be replaced with int and removed. More...
 
typedef std::vector< LAYER_IDBASE_SEQ
 A sequence of layers, a sequence provides a certain order. More...
 
typedef std::bitset< LAYER_ID_COUNTBASE_SET
 

Enumerations

enum  LAYER_ID : int {
  F_Cu, In1_Cu, In2_Cu, In3_Cu,
  In4_Cu, In5_Cu, In6_Cu, In7_Cu,
  In8_Cu, In9_Cu, In10_Cu, In11_Cu,
  In12_Cu, In13_Cu, In14_Cu, In15_Cu,
  In16_Cu, In17_Cu, In18_Cu, In19_Cu,
  In20_Cu, In21_Cu, In22_Cu, In23_Cu,
  In24_Cu, In25_Cu, In26_Cu, In27_Cu,
  In28_Cu, In29_Cu, In30_Cu, B_Cu,
  B_Adhes, F_Adhes, B_Paste, F_Paste,
  B_SilkS, F_SilkS, B_Mask, F_Mask,
  Dwgs_User, Cmts_User, Eco1_User, Eco2_User,
  Edge_Cuts, Margin, B_CrtYd, F_CrtYd,
  B_Fab, F_Fab, LAYER_ID_COUNT, UNDEFINED_LAYER = -1,
  UNSELECTED_LAYER = -2
}
 Enum LAYER_ID is the set of PCB layers. More...
 
enum  PCB_VISIBLE {
  VIAS_VISIBLE, VIA_MICROVIA_VISIBLE, VIA_BBLIND_VISIBLE, VIA_THROUGH_VISIBLE,
  NON_PLATED_VISIBLE, MOD_TEXT_FR_VISIBLE, MOD_TEXT_BK_VISIBLE, MOD_TEXT_INVISIBLE,
  ANCHOR_VISIBLE, PAD_FR_VISIBLE, PAD_BK_VISIBLE, RATSNEST_VISIBLE,
  GRID_VISIBLE, NO_CONNECTS_VISIBLE, MOD_FR_VISIBLE, MOD_BK_VISIBLE,
  MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE, TRACKS_VISIBLE, PADS_VISIBLE,
  PADS_HOLES_VISIBLE, VIAS_HOLES_VISIBLE, DRC_VISIBLE, WORKSHEET,
  GP_OVERLAY, END_PCB_VISIBLE_LIST
}
 Enum PCB_VISIBLE is a set of visible PCB elements. More...
 
enum  NETNAMES_VISIBLE { PAD_FR_NETNAMES_VISIBLE = B_Cu+1, PAD_BK_NETNAMES_VISIBLE, PADS_NETNAMES_VISIBLE, END_NETNAMES_VISIBLE_LIST }
 Enum NETNAMES_VISIBLE is a set of layers specific for displaying net names. More...
 

Functions

bool IsValidLayer (LAYER_NUM aLayerId)
 Function IsValidLayer tests whether a given integer is a valid layer index, i.e. More...
 
bool IsPcbLayer (LAYER_NUM aLayer)
 Function IsPcbLayer tests whether a layer is a valid layer for pcbnew. More...
 
bool IsCopperLayer (LAYER_NUM aLayerId)
 Function IsCopperLayer tests whether a layer is a copper layer. More...
 
bool IsNonCopperLayer (LAYER_NUM aLayerId)
 Function IsNonCopperLayer tests whether a layer is a non copper layer. More...
 
bool IsUserLayer (LAYER_ID aLayerId)
 Function IsUserLayer tests whether a layer is a non copper and a non tech layer. More...
 
bool IsFrontLayer (LAYER_ID aLayerId)
 Layer classification: check if it's a front layer. More...
 
bool IsBackLayer (LAYER_ID aLayerId)
 Layer classification: check if it's a back layer. More...
 
LAYER_ID FlipLayer (LAYER_ID aLayerId, int aCopperLayersCount=0)
 Function FlippedLayerNumber. More...
 
LSET FlipLayerMask (LSET aMask, int aCopperLayersCount=0)
 Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask, paste, solder layers are swapped internal layers are flipped only if the copper layers count is known. More...
 
int GetNetnameLayer (int aLayer)
 Returns a netname layer corresponding to the given layer. More...
 
bool IsNetnameLayer (LAYER_NUM aLayer)
 Function IsNetnameLayer tests whether a layer is a netname layer. More...
 
LAYER_ID ToLAYER_ID (int aLayer)
 

Detailed Description

Board layer functions and definitions.

Definition in file layers_id_colors_and_visibility.h.

Macro Definition Documentation

#define MIN_VISIBILITY_MASK
#define TOTAL_LAYER_COUNT   (LAYER_ID_COUNT + END_PCB_VISIBLE_LIST + END_NETNAMES_VISIBLE_LIST)

number of all GAL layers including PCB and item layers

Definition at line 530 of file layers_id_colors_and_visibility.h.

Referenced by KIGFX::PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS(), and KIGFX::RENDER_SETTINGS::update().

Typedef Documentation

typedef std::vector<LAYER_ID> BASE_SEQ

A sequence of layers, a sequence provides a certain order.

Definition at line 126 of file layers_id_colors_and_visibility.h.

typedef std::bitset<LAYER_ID_COUNT> BASE_SET

Definition at line 176 of file layers_id_colors_and_visibility.h.

typedef int LAYER_NUM

Type LAYER_NUM can be replaced with int and removed.

Until then, it is something you can increment, and its meaning is only advisory but can extend beyond PCB layers into view layers and gerber layers.

Definition at line 39 of file layers_id_colors_and_visibility.h.

Enumeration Type Documentation

enum LAYER_ID : int

Enum LAYER_ID is the set of PCB layers.

It has nothing to do with gerbers or view layers. One of these cannot be "incremented".

Enumerator
F_Cu 
In1_Cu 
In2_Cu 
In3_Cu 
In4_Cu 
In5_Cu 
In6_Cu 
In7_Cu 
In8_Cu 
In9_Cu 
In10_Cu 
In11_Cu 
In12_Cu 
In13_Cu 
In14_Cu 
In15_Cu 
In16_Cu 
In17_Cu 
In18_Cu 
In19_Cu 
In20_Cu 
In21_Cu 
In22_Cu 
In23_Cu 
In24_Cu 
In25_Cu 
In26_Cu 
In27_Cu 
In28_Cu 
In29_Cu 
In30_Cu 
B_Cu 
B_Adhes 
F_Adhes 
B_Paste 
F_Paste 
B_SilkS 
F_SilkS 
B_Mask 
F_Mask 
Dwgs_User 
Cmts_User 
Eco1_User 
Eco2_User 
Edge_Cuts 
Margin 
B_CrtYd 
F_CrtYd 
B_Fab 
F_Fab 
LAYER_ID_COUNT 
UNDEFINED_LAYER 
UNSELECTED_LAYER 

Definition at line 56 of file layers_id_colors_and_visibility.h.

56  : int
57 {
58  F_Cu, // 0
59  In1_Cu,
60  In2_Cu,
61  In3_Cu,
62  In4_Cu,
63  In5_Cu,
64  In6_Cu,
65  In7_Cu,
66  In8_Cu,
67  In9_Cu,
68  In10_Cu,
69  In11_Cu,
70  In12_Cu,
71  In13_Cu,
72  In14_Cu,
73  In15_Cu,
74  In16_Cu,
75  In17_Cu,
76  In18_Cu,
77  In19_Cu,
78  In20_Cu,
79  In21_Cu,
80  In22_Cu,
81  In23_Cu,
82  In24_Cu,
83  In25_Cu,
84  In26_Cu,
85  In27_Cu,
86  In28_Cu,
87  In29_Cu,
88  In30_Cu,
89  B_Cu, // 31
90 
91  B_Adhes,
92  F_Adhes,
93 
94  B_Paste,
95  F_Paste,
96 
97  B_SilkS,
98  F_SilkS,
99 
100  B_Mask,
101  F_Mask,
102 
103  Dwgs_User,
104  Cmts_User,
105  Eco1_User,
106  Eco2_User,
107  Edge_Cuts,
108  Margin,
109 
110  B_CrtYd,
111  F_CrtYd,
112 
113  B_Fab,
114  F_Fab,
115 
117 
118  UNDEFINED_LAYER = -1,
119  UNSELECTED_LAYER = -2,
120 };

Enum NETNAMES_VISIBLE is a set of layers specific for displaying net names.

Their visiblity is not supposed to be saved in a board file, they are only to be used by the GAL.

Enumerator
PAD_FR_NETNAMES_VISIBLE 
PAD_BK_NETNAMES_VISIBLE 
PADS_NETNAMES_VISIBLE 
END_NETNAMES_VISIBLE_LIST 

Definition at line 513 of file layers_id_colors_and_visibility.h.

Enum PCB_VISIBLE is a set of visible PCB elements.

See also
BOARD::SetVisibleElementColor()
BOARD::SetVisibleElement()
Enumerator
VIAS_VISIBLE 
VIA_MICROVIA_VISIBLE 
VIA_BBLIND_VISIBLE 
VIA_THROUGH_VISIBLE 
NON_PLATED_VISIBLE 
MOD_TEXT_FR_VISIBLE 
MOD_TEXT_BK_VISIBLE 
MOD_TEXT_INVISIBLE 

text marked as invisible

ANCHOR_VISIBLE 
PAD_FR_VISIBLE 
PAD_BK_VISIBLE 
RATSNEST_VISIBLE 
GRID_VISIBLE 
NO_CONNECTS_VISIBLE 

show a marker on pads with no nets

MOD_FR_VISIBLE 

show modules on front

MOD_BK_VISIBLE 

show modules on back

MOD_VALUES_VISIBLE 

show modules values (when texts are visibles)

MOD_REFERENCES_VISIBLE 

show modules references (when texts are visibles)

TRACKS_VISIBLE 
PADS_VISIBLE 

multilayer pads, usually with holes

PADS_HOLES_VISIBLE 
VIAS_HOLES_VISIBLE 
DRC_VISIBLE 

drc markers

WORKSHEET 

worksheet frame

GP_OVERLAY 

general purpose overlay

END_PCB_VISIBLE_LIST 

Definition at line 432 of file layers_id_colors_and_visibility.h.

433 {
434  VIAS_VISIBLE,
446  GRID_VISIBLE,
447 
448  // the rest of these do not currently support color changes:
454 
456  PADS_VISIBLE,
459 
460  DRC_VISIBLE,
461  WORKSHEET,
462  GP_OVERLAY,
463 
464  END_PCB_VISIBLE_LIST // sentinel
465 };
show modules on front
multilayer pads, usually with holes
text marked as invisible
show a marker on pads with no nets
show modules references (when texts are visibles)
general purpose overlay
show modules values (when texts are visibles)

Function Documentation

LAYER_ID FlipLayer ( LAYER_ID  aLayerId,
int  aCopperLayersCount = 0 
)

Function FlippedLayerNumber.

Returns
the layer number after flipping an item some (not all) layers: external copper, and paired layers( Mask, Paste, solder ... ) are swapped between front and back sides internal layers are flipped only if the copper layers count is known
Parameters
aLayer= the LAYER_ID to flip
aCopperLayersCount= the number of copper layers. if 0 (in fact if < 4 ) internal layers will be not flipped because the layer count is not known

Definition at line 444 of file lset.cpp.

References B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, In1_Cu, and IsCopperLayer().

Referenced by PCAD2KICAD::PCB_ARC::Flip(), PCAD2KICAD::PCB_PAD::Flip(), PCAD2KICAD::PCB_LINE::Flip(), PCAD2KICAD::PCB_MODULE::Flip(), TEXTE_PCB::Flip(), PCB_TARGET::Flip(), EDGE_MODULE::Flip(), TEXTE_MODULE::Flip(), TRACK::Flip(), MODULE::Flip(), DIMENSION::Flip(), DRAWSEGMENT::Flip(), ZONE_CONTAINER::Flip(), and VIA::Flip().

445 {
446  switch( aLayerId )
447  {
448  case B_Cu: return F_Cu;
449  case F_Cu: return B_Cu;
450 
451  case B_SilkS: return F_SilkS;
452  case F_SilkS: return B_SilkS;
453 
454  case B_Adhes: return F_Adhes;
455  case F_Adhes: return B_Adhes;
456 
457  case B_Mask: return F_Mask;
458  case F_Mask: return B_Mask;
459 
460  case B_Paste: return F_Paste;
461  case F_Paste: return B_Paste;
462 
463  case B_CrtYd: return F_CrtYd;
464  case F_CrtYd: return B_CrtYd;
465 
466  case B_Fab: return F_Fab;
467  case F_Fab: return B_Fab;
468 
469  default: // change internal layer if aCopperLayersCount is >= 4
470  if( IsCopperLayer( aLayerId ) && aCopperLayersCount >= 4 )
471  {
472  // internal copper layers count is aCopperLayersCount-2
473  LAYER_ID fliplayer = LAYER_ID(aCopperLayersCount - 2 - ( aLayerId - In1_Cu ) );
474  // Ensure fliplayer has a value which does not crash pcbnew:
475  if( fliplayer < F_Cu )
476  fliplayer = F_Cu;
477 
478  if( fliplayer > B_Cu )
479  fliplayer = B_Cu;
480 
481  return fliplayer;
482  }
483 
484  // No change for the other layers
485  return aLayerId;
486  }
487 }
LAYER_ID
Enum LAYER_ID is the set of PCB layers.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
LSET FlipLayerMask ( LSET  aMask,
int  aCopperLayersCount = 0 
)

Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask, paste, solder layers are swapped internal layers are flipped only if the copper layers count is known.

Parameters
aMask= the LSET to flip
aCopperLayersCount= the number of copper layers. if 0 (in fact if < 4 ) internal layers will be not flipped because the layer count is not known

Definition at line 490 of file lset.cpp.

References B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, In1_Cu, and LSET::InternalCuMask().

Referenced by D_PAD::Flip(), DIALOG_PAD_PROPERTIES::initValues(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

491 {
492  // layers on physical outside of a board:
493  const static LSET and_mask( 16, // !! update count
494  B_Cu, F_Cu,
495  B_SilkS, F_SilkS,
496  B_Adhes, F_Adhes,
497  B_Mask, F_Mask,
498  B_Paste, F_Paste,
499  B_Adhes, F_Adhes,
500  B_CrtYd, F_CrtYd,
501  B_Fab, F_Fab
502  );
503 
504  LSET newMask = aMask & ~and_mask;
505 
506  if( aMask[B_Cu] )
507  newMask.set( F_Cu );
508 
509  if( aMask[F_Cu] )
510  newMask.set( B_Cu );
511 
512  if( aMask[B_SilkS] )
513  newMask.set( F_SilkS );
514 
515  if( aMask[F_SilkS] )
516  newMask.set( B_SilkS );
517 
518  if( aMask[B_Adhes] )
519  newMask.set( F_Adhes );
520 
521  if( aMask[F_Adhes] )
522  newMask.set( B_Adhes );
523 
524  if( aMask[B_Mask] )
525  newMask.set( F_Mask );
526 
527  if( aMask[F_Mask] )
528  newMask.set( B_Mask );
529 
530  if( aMask[B_Paste] )
531  newMask.set( F_Paste );
532 
533  if( aMask[F_Paste] )
534  newMask.set( B_Paste );
535 
536  if( aMask[B_Adhes] )
537  newMask.set( F_Adhes );
538 
539  if( aMask[F_Adhes] )
540  newMask.set( B_Adhes );
541 
542  if( aMask[B_CrtYd] )
543  newMask.set( F_CrtYd );
544 
545  if( aMask[F_CrtYd] )
546  newMask.set( B_CrtYd );
547 
548  if( aMask[B_Fab] )
549  newMask.set( F_Fab );
550 
551  if( aMask[F_Fab] )
552  newMask.set( B_Fab );
553 
554  if( aCopperLayersCount >= 4 ) // Internal layers exist
555  {
556  LSET internalMask = aMask & ~LSET::InternalCuMask();
557 
558  if( internalMask != LSET::InternalCuMask() )
559  { // the mask does not include all internal layers. Therefore
560  // the flipped mask for internal copper layers must be built
561  int innerLayerCnt = aCopperLayersCount -2;
562 
563  for( int ii = 0; ii < innerLayerCnt; ii++ )
564  {
565  if( internalMask[innerLayerCnt - ii + In1_Cu] )
566  newMask.set( ii + In1_Cu );
567  else
568  newMask.reset( ii + In1_Cu );
569  }
570  }
571  }
572 
573  return newMask;
574 }
Class LSET is a set of LAYER_IDs.
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:598
int GetNetnameLayer ( int  aLayer)
inline

Returns a netname layer corresponding to the given layer.

Definition at line 671 of file layers_id_colors_and_visibility.h.

References Cmts_User, IsCopperLayer(), ITEM_GAL_LAYER, NETNAMES_GAL_LAYER, PAD_BK_NETNAMES_VISIBLE, PAD_BK_VISIBLE, PAD_FR_NETNAMES_VISIBLE, PAD_FR_VISIBLE, PADS_NETNAMES_VISIBLE, and PADS_VISIBLE.

Referenced by KIGFX::PCB_RENDER_SETTINGS::ImportLegacyColors(), PCB_LAYER_WIDGET::OnLayerColorChange(), PCB_DRAW_PANEL_GAL::setDefaultLayerDeps(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetTopLayer(), PCB_DRAW_PANEL_GAL::SyncLayersVisibility(), and TRACK::ViewGetLayers().

672 {
673  if( IsCopperLayer( aLayer ) )
674  return NETNAMES_GAL_LAYER( aLayer );
675  else if( aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) )
677  else if( aLayer == ITEM_GAL_LAYER( PAD_FR_VISIBLE ) )
679  else if( aLayer == ITEM_GAL_LAYER( PAD_BK_VISIBLE ) )
681 
682  // Fallback
683  return Cmts_User;
684 }
multilayer pads, usually with holes
#define ITEM_GAL_LAYER(layer)
macro for obtaining layer number for specific item (eg. pad or text)
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
#define NETNAMES_GAL_LAYER(layer)
bool IsBackLayer ( LAYER_ID  aLayerId)
inline

Layer classification: check if it's a back layer.

Definition at line 625 of file layers_id_colors_and_visibility.h.

References B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, and B_SilkS.

Referenced by TEXTE_MODULE::Draw(), TEXTE_MODULE::Flip(), BOARD::GetFootprint(), GENERAL_COLLECTOR::Inspect(), DRAWING_TOOL::PlaceText(), PCB_DRAW_PANEL_GAL::SetTopLayer(), TEXTE_MODULE::TEXTE_MODULE(), DialogEditModuleText::TransferDataFromWindow(), and TEXTE_MODULE::ViewGetLOD().

626 {
627  switch( aLayerId )
628  {
629  case B_Cu:
630  case B_Adhes:
631  case B_Paste:
632  case B_SilkS:
633  case B_Mask:
634  case B_CrtYd:
635  case B_Fab:
636  return true;
637  default:
638  ;
639  }
640 
641  return false;
642 }
bool IsCopperLayer ( LAYER_NUM  aLayerId)
inline

Function IsCopperLayer tests whether a layer is a copper layer.

Parameters
aLayerId= Layer to test
Returns
true if aLayer is a valid copper layer

Definition at line 562 of file layers_id_colors_and_visibility.h.

References B_Cu, and F_Cu.

Referenced by PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCB_EDIT_FRAME::Begin_Zone(), BOARD::BOARD(), PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), ZONE_CREATE_HELPER::createNewZone(), PCB_EDIT_FRAME::Delete_Drawings_All_Layer(), EDGE_MODULE::Draw(), KIGFX::PCB_PAINTER::draw(), D_PAD::Draw(), FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer(), PCB_EDIT_FRAME::Edit_Zone_Params(), FlipLayer(), DSN::SPECCTRA_DB::FromBOARD(), GenCADLayerName(), DRAWING_TOOL::getDrawingLayer(), GetGerberFileFunctionAttribute(), GetGerberFilePolarityAttribute(), GetGerberProtelExtension(), BOARD::GetLayerID(), DIALOG_LAYERS_SETUP::getLayerName(), BOARD::GetLayerName(), BOARD::GetLayerType(), GetNetnameLayer(), DIALOG_SVG_PRINT::initDialog(), DIALOG_PRINT_USING_PRINTER::initValues(), ZONE_CONTAINER::IsOnCopperLayer(), MARKER_PCB::IsOnLayer(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), BOARD::OnAreaPolygonModified(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_PLOT::OnPopUpLayers(), PCB_LAYER_WIDGET::onPopupSelection(), PCB_EDIT_FRAME::OnRightClick(), EAGLE_PLUGIN::packageSMD(), PNS::TOOL_BASE::pickSingleItem(), PlotOneBoardLayer(), BRDITEMS_PLOTTER::PlotTextePcb(), ROUTER_TOOL::prepareInteractive(), SWAP_LAYERS_DIALOG::Sel_Layer(), PCB_DRAW_PANEL_GAL::setDefaultLayerDeps(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), BOARD::SetLayerName(), BOARD::SetLayerType(), PCB_DRAW_PANEL_GAL::SetTopLayer(), ShowClearance(), PCB_BASE_FRAME::SwitchLayer(), PCB_EDIT_FRAME::SwitchLayer(), PCB_DRAW_PANEL_GAL::SyncLayersVisibility(), DRC::testTexts(), and DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow().

563 {
564  return aLayerId >= F_Cu && aLayerId <= B_Cu;
565 }
bool IsFrontLayer ( LAYER_ID  aLayerId)
inline

Layer classification: check if it's a front layer.

Definition at line 602 of file layers_id_colors_and_visibility.h.

References F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, and F_SilkS.

Referenced by TEXTE_MODULE::Draw(), GENERAL_COLLECTOR::Inspect(), PCB_DRAW_PANEL_GAL::SetTopLayer(), and TEXTE_MODULE::ViewGetLOD().

603 {
604  switch( aLayerId )
605  {
606  case F_Cu:
607  case F_Adhes:
608  case F_Paste:
609  case F_SilkS:
610  case F_Mask:
611  case F_CrtYd:
612  case F_Fab:
613  return true;
614  default:
615  ;
616  }
617 
618  return false;
619 }
bool IsNetnameLayer ( LAYER_NUM  aLayer)
inline

Function IsNetnameLayer tests whether a layer is a netname layer.

Parameters
aLayer= Layer to test
Returns
true if aLayer is a valid netname layer

Definition at line 692 of file layers_id_colors_and_visibility.h.

References END_NETNAMES_VISIBLE_LIST, F_Cu, and NETNAMES_GAL_LAYER.

Referenced by KIGFX::PCB_PAINTER::draw(), PCB_DRAW_PANEL_GAL::setDefaultLayerDeps(), TRACK::ViewGetLOD(), and D_PAD::ViewGetLOD().

bool IsNonCopperLayer ( LAYER_NUM  aLayerId)
inline

Function IsNonCopperLayer tests whether a layer is a non copper layer.

Parameters
aLayerId= Layer to test
Returns
true if aLayer is a non copper layer

Definition at line 573 of file layers_id_colors_and_visibility.h.

References B_Cu, and LAYER_ID_COUNT.

Referenced by PCAD2KICAD::PCB_ARC::AddToModule(), PCAD2KICAD::PCB_LINE::AddToModule(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), and EAGLE_PLUGIN::packageWire().

574 {
575  return aLayerId > B_Cu && aLayerId <= LAYER_ID_COUNT;
576 }
bool IsPcbLayer ( LAYER_NUM  aLayer)
inline

Function IsPcbLayer tests whether a layer is a valid layer for pcbnew.

Parameters
aLayer= Layer to test
Returns
true if aLayer is a layer valid in pcbnew

Definition at line 551 of file layers_id_colors_and_visibility.h.

References F_Cu, and LAYER_ID_COUNT.

Referenced by GBR_TO_PCB_EXPORTER::ExportPcb().

552 {
553  return aLayer >= F_Cu && aLayer < LAYER_ID_COUNT;
554 }
bool IsUserLayer ( LAYER_ID  aLayerId)
inline

Function IsUserLayer tests whether a layer is a non copper and a non tech layer.

Parameters
aLayerId= Layer to test
Returns
true if aLayer is a user layer

Definition at line 584 of file layers_id_colors_and_visibility.h.

References Dwgs_User, and Eco2_User.

585 {
586  return aLayerId >= Dwgs_User && aLayerId <= Eco2_User;
587 }
bool IsValidLayer ( LAYER_NUM  aLayerId)
inline

Function IsValidLayer tests whether a given integer is a valid layer index, i.e.

can be safely put in a LAYER_ID

Parameters
aLayerId= Layer index to test. It can be an int, so its useful during I/O
Returns
true if aLayerIndex is a valid layer index

Definition at line 540 of file layers_id_colors_and_visibility.h.

References LAYER_ID_COUNT.

Referenced by LAYERS_MAP_DIALOG::OnSelectLayer(), and SWAP_LAYERS_DIALOG::Sel_Layer().

541 {
542  return unsigned( aLayerId ) < LAYER_ID_COUNT;
543 }
LAYER_ID ToLAYER_ID ( int  aLayer)

Definition at line 766 of file lset.cpp.

References LAYER_ID_COUNT.

Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), DXF2BRD_CONVERTER::addArc(), DXF2BRD_CONVERTER::addCircle(), PNS_KICAD_IFACE::AddItem(), DXF2BRD_CONVERTER::addLine(), DXF2BRD_CONVERTER::addMText(), DXF2BRD_CONVERTER::addPolyline(), DXF2BRD_CONVERTER::addText(), BOARD::BOARD(), DSN::SPECCTRA_DB::buildLayerMaps(), CINFO3D_VISU::createLayers(), PCB_BASE_FRAME::CreateNewModule(), EVT_COMMAND_RANGE(), EXCELLON_WRITER::GenDrillReportFile(), BRDITEMS_PLOTTER::getColor(), GetGerberFileFunctionAttribute(), PCB_LAYER_SELECTOR::GetLayerColor(), PCB_LAYER_BOX_SELECTOR::GetLayerColor(), BOARD::GetLayerID(), PCB_LAYER_SELECTOR::GetLayerName(), PCB_LAYER_BOX_SELECTOR::GetLayerName(), DXF2BRD_CONVERTER::insertArc(), DXF2BRD_CONVERTER::insertLine(), PCB_LAYER_BOX_SELECTOR::IsLayerEnabled(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCAD2KICAD::PCB::MapLayer(), PCB_EDIT_FRAME::OnHotKey(), PCB_LAYER_WIDGET::OnLayerColorChange(), PCB_LAYER_WIDGET::OnLayerSelect(), DIALOG_DIMENSION_EDITOR::OnOKClick(), PCB_LAYER_WIDGET::onPopupSelection(), PLOT_CONTROLLER::OpenPlotfile(), PCB_EDIT_FRAME::Other_Layer_Route(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), PLOT_CONTROLLER::PlotLayer(), ROUTER_TOOL::prepareInteractive(), PCB_EDIT_FRAME::Process_Special_Functions(), SWAP_LAYERS_DIALOG::Sel_Layer(), PCB_BASE_FRAME::SelectLayer(), DIALOG_GLOBAL_DELETION::SetCurrentLayer(), ROUTER_TOOL::switchLayerOnViaPlacement(), PCB_LAYER_WIDGET::SyncLayerVisibilities(), DialogEditModuleText::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow().

767 {
768  wxASSERT( unsigned( aLayer ) < LAYER_ID_COUNT );
769  return LAYER_ID( aLayer );
770 }
LAYER_ID
Enum LAYER_ID is the set of PCB layers.