KiCad PCB EDA Suite
LSET Class Reference

LSET is a set of PCB_LAYER_IDs. More...

#include <layer_ids.h>

Inheritance diagram for LSET:

Public Member Functions

 LSET ()
 Create an empty (cleared) set. More...
 
 LSET (const BASE_SET &aOther)
 
 LSET (PCB_LAYER_ID aLayer)
 Take a PCB_LAYER_ID and sets that bit. More...
 
 LSET (const PCB_LAYER_ID *aArray, unsigned aCount)
 Create an array or LSEQ. More...
 
 LSET (unsigned aIdCount, int aFirst,...)
 Take one or more PCB_LAYER_IDs in the argument list to construct the set. More...
 
bool Contains (PCB_LAYER_ID aLayer)
 See if the layer set contains a PCB layer. More...
 
LSEQ CuStack () const
 Return a sequence of copper layers in starting from the front/top and extending to the back/bottom. More...
 
LSEQ Technicals (LSET aSubToOmit=LSET()) const
 Return a sequence of technical layers. More...
 
LSEQ Users () const
 *_User layers. More...
 
LSEQ TechAndUserUIOrder () const
 Returns the technical and user layers in the order shown in layer widget. More...
 
LSEQ UIOrder () const
 
LSEQ Seq (const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
 Return an LSEQ from the union of this LSET and a desired sequence. More...
 
LSEQ Seq () const
 Return a LSEQ from this LSET in ascending PCB_LAYER_ID order. More...
 
LSEQ SeqStackupBottom2Top () const
 Return the sequence that is typical for a bottom-to-top stack-up. More...
 
std::string FmtHex () const
 Return a hex string showing contents of this LSEQ. More...
 
int ParseHex (const char *aStart, int aCount)
 Convert the output of FmtHex() and replaces this set's values with those given in the input string. More...
 
std::string FmtBin () const
 Return a binary string showing contents of this LSEQ. More...
 
PCB_LAYER_ID ExtractLayer () const
 Find the first set PCB_LAYER_ID. More...
 

Static Public Member Functions

static const wxChar * Name (PCB_LAYER_ID aLayerId)
 Return the fixed name association with aLayerId. More...
 
static LSET InternalCuMask ()
 Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu. More...
 
static LSET FrontAssembly ()
 Return a complete set of all top assembly layers which is all F_SilkS and F_Mask. More...
 
static LSET BackAssembly ()
 Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask. More...
 
static LSET AllCuMask (int aCuLayerCount=MAX_CU_LAYERS)
 Return a mask holding the requested number of Cu PCB_LAYER_IDs. More...
 
static LSET ExternalCuMask ()
 Return a mask holding the Front and Bottom layers. More...
 
static LSET AllNonCuMask ()
 Return a mask holding all layer minus CU layers. More...
 
static LSET AllLayersMask ()
 
static LSET FrontTechMask ()
 Return a mask holding all technical layers (no CU layer) on front side. More...
 
static LSET FrontBoardTechMask ()
 Return a mask holding technical layers used in a board fabrication (no CU layer) on front side. More...
 
static LSET BackTechMask ()
 Return a mask holding all technical layers (no CU layer) on back side. More...
 
static LSET BackBoardTechMask ()
 Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side. More...
 
static LSET AllTechMask ()
 Return a mask holding all technical layers (no CU layer) on both side. More...
 
static LSET AllBoardTechMask ()
 Return a mask holding board technical layers (no CU layer) on both side. More...
 
static LSET FrontMask ()
 Return a mask holding all technical layers and the external CU layer on front side. More...
 
static LSET BackMask ()
 Return a mask holding all technical layers and the external CU layer on back side. More...
 
static LSET UserMask ()
 
static LSET PhysicalLayersMask ()
 Return a mask holding all layers which are physically realized. More...
 
static LSET UserDefinedLayers ()
 Return a mask with all of the allowable user defined layers. More...
 
static LSET ForbiddenFootprintLayers ()
 Layers which are not allowed within footprint definitions. More...
 

Private Member Functions

 LSET (unsigned long __val)
 Take this off the market, it may not be used because of LSET( PCB_LAYER_ID ). More...
 

Detailed Description

LSET is a set of PCB_LAYER_IDs.

It can be converted to numerous purpose LSEQs using the various member functions, most of which are based on Seq(). The advantage of converting to LSEQ using purposeful code, is it removes any dependency on order/sequence inherent in this set.

Definition at line 516 of file layer_ids.h.

Constructor & Destructor Documentation

◆ LSET() [1/6]

LSET::LSET ( )
inline

Create an empty (cleared) set.

Definition at line 533 of file layer_ids.h.

533  :
534  BASE_SET() // all bits are set to zero in BASE_SET()
535  {
536  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
Definition: layer_ids.h:507

Referenced by AllLayersMask(), and AllNonCuMask().

◆ LSET() [2/6]

LSET::LSET ( const BASE_SET aOther)
inline

Definition at line 538 of file layer_ids.h.

538  :
539  BASE_SET( aOther )
540  {
541  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
Definition: layer_ids.h:507

◆ LSET() [3/6]

LSET::LSET ( PCB_LAYER_ID  aLayer)
inline

Take a PCB_LAYER_ID and sets that bit.

This makes the following code into a bug:

LSET s = 0;

Instead use:

LSET s;

for an empty set.

Definition at line 557 of file layer_ids.h.

557  : // PCB_LAYER_ID deliberately excludes int and relatives
558  BASE_SET()
559  {
560  set( aLayer );
561  }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
Definition: layer_ids.h:507

◆ LSET() [4/6]

LSET::LSET ( const PCB_LAYER_ID aArray,
unsigned  aCount 
)

Create an array or LSEQ.

Definition at line 39 of file lset.cpp.

39  :
40  BASE_SET()
41 {
42  for( unsigned i=0; i<aCount; ++i )
43  set( aArray[i] );
44 }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
Definition: layer_ids.h:507

◆ LSET() [5/6]

LSET::LSET ( unsigned  aIdCount,
int  aFirst,
  ... 
)

Take one or more PCB_LAYER_IDs in the argument list to construct the set.

Typically only used in static construction.

Parameters
aIdCountis the number of PCB_LAYER_IDs which follow.
aFirstis the first included in aIdCount and must always be present, and can be followed by any number of additional PCB_LAYER_IDs so long as aIdCount accurately reflects the count.

Parameter is 'int' to avoid va_start undefined behavior.

Definition at line 47 of file lset.cpp.

47  :
48  BASE_SET()
49 {
50  // The constructor, without the mandatory aFirst argument, could have been confused
51  // by the compiler with the LSET( PCB_LAYER_ID ). With aFirst, that ambiguity is not
52  // present. Therefore aIdCount must always be >=1.
53  wxASSERT_MSG( aIdCount > 0, wxT( "aIdCount must be >= 1" ) );
54 
55  set( aFirst );
56 
57  if( --aIdCount )
58  {
59  va_list ap;
60 
61  va_start( ap, aFirst );
62 
63  for( unsigned i=0; i<aIdCount; ++i )
64  {
65  PCB_LAYER_ID id = (PCB_LAYER_ID) va_arg( ap, int );
66 
67  assert( unsigned( id ) < PCB_LAYER_ID_COUNT );
68 
69  set( id );
70  }
71 
72  va_end( ap );
73  }
74 }
std::bitset< PCB_LAYER_ID_COUNT > BASE_SET
Definition: layer_ids.h:507
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

References PCB_LAYER_ID_COUNT.

◆ LSET() [6/6]

LSET::LSET ( unsigned long  __val)
inlineprivate

Take this off the market, it may not be used because of LSET( PCB_LAYER_ID ).

Definition at line 772 of file layer_ids.h.

773  {
774  // not usable, it's private.
775  }

Member Function Documentation

◆ AllBoardTechMask()

LSET LSET::AllBoardTechMask ( )
static

Return a mask holding board technical layers (no CU layer) on both side.

Definition at line 836 of file lset.cpp.

837 {
838  static const LSET saved = BackBoardTechMask() | FrontBoardTechMask();
839  return saved;
840 }
static LSET FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
Definition: lset.cpp:822
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
static LSET BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
Definition: lset.cpp:809

References BackBoardTechMask(), and FrontBoardTechMask().

Referenced by DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), PhysicalLayersMask(), and CADSTAR_PCB_ARCHIVE_LOADER::remapUnsureLayers().

◆ AllCuMask()

LSET LSET::AllCuMask ( int  aCuLayerCount = MAX_CU_LAYERS)
static

Return a mask holding the requested number of Cu PCB_LAYER_IDs.

Definition at line 759 of file lset.cpp.

760 {
761  // retain all in static as the full set, which is a common case.
762  static const LSET all = InternalCuMask().set( F_Cu ).set( B_Cu );
763 
764  if( aCuLayerCount == MAX_CU_LAYERS )
765  return all;
766 
767  // subtract out some Cu layers not wanted in the mask.
768  LSET ret = all;
769  int clear_count = MAX_CU_LAYERS - aCuLayerCount;
770 
771  clear_count = Clamp( 0, clear_count, MAX_CU_LAYERS - 2 );
772 
773  for( LAYER_NUM elem=In30_Cu; clear_count; --elem, --clear_count )
774  {
775  ret.set( elem, false );
776  }
777 
778  return ret;
779 }
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
#define MAX_CU_LAYERS
Definition: layer_ids.h:147
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:719
Definition: layer_ids.h:71
const T & Clamp(const T &lower, const T &value, const T &upper)
Limit value within the range lower <= value <= upper.
Definition: util.h:52

References B_Cu, Clamp(), F_Cu, In30_Cu, InternalCuMask(), and MAX_CU_LAYERS.

Referenced by PCAD2KICAD::PCB_PAD::AddToFootprint(), AllNonCuMask(), DIALOG_PLOT::applyPlotSettings(), TRACKS_CLEANER::cleanup(), HYPERLYNX_EXPORTER::collectNetObjects(), compute_pad_access_code(), EXPORTER_PCB_VRML::ComputeLayer3D_Zpos(), BOARD_ADAPTER::createLayers(), ZONE_CREATE_HELPER::createNewZone(), DIALOG_EXPORT_SVG::CreateSVGFile(), PANEL_SETUP_LAYERS::DenyChangeCheckBox(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), ZONE_FILLER::Fill(), fmt_mask(), PCB_PLUGIN::formatLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadLayerSet(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), PCB_VIA::GetLayerSet(), BOARD::GetPad(), HYPERLYNX_PAD_STACK::getSMDLayer(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), FOOTPRINT::GetUniquePadCount(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::highlightNet(), HYPERLYNX_PAD_STACK::HYPERLYNX_PAD_STACK(), PCB_PARSER::init(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), PAD::IsAperturePad(), HYPERLYNX_PAD_STACK::isEmpty(), ZONE::IsOnCopperLayer(), PAD::IsOnCopperLayer(), DSN::isRoundKeepout(), BOARD_ITEM::layerMaskDescribe(), LEGACY_PLUGIN::leg_mask2new(), CADSTAR_PCB_ARCHIVE_LOADER::Load(), KIGFX::PCB_RENDER_SETTINGS::LoadColors(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers(), FABMASTER::loadZone(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), DIALOG_PLOT::OnPopUpLayers(), DIALOG_PAD_PROPERTIES::OnUpdateUI(), DIALOG_PAD_PROPERTIES::OnUpdateUINonCopperWarning(), EAGLE_PLUGIN::packageHole(), EAGLE_PLUGIN::packagePad(), DIALOG_PAD_PROPERTIES::padValuesOK(), PCB_PLOT_PARAMS_PARSER::Parse(), ALTIUM_PCB::ParseArcs6Data(), GPCB_FPL_CACHE::parseFOOTPRINT(), DRC_RULES_PARSER::parseLayer(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTracks6Data(), PCB_PLOT_PARAMS::PCB_PLOT_PARAMS(), PhysicalLayersMask(), DRAWING_TOOL::PlaceCharacteristics(), DRAWING_TOOL::PlaceStackup(), DIALOG_PLOT::Plot(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPad(), PlotStandardLayer(), PAD::PTHMask(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), BOARD_DESIGN_SETTINGS::SetCopperLayerCount(), BOARD_DESIGN_SETTINGS::SetEnabledLayers(), setKeepoutSettingsToZone(), PCBNEW_PRINTOUT::setupViewLayers(), PANEL_SETUP_LAYERS::showLayerTypes(), PNS_KICAD_IFACE_BASE::syncPad(), DRC_TEST_PROVIDER_MISC::testDisabledLayers(), DIALOG_SWAP_LAYERS::TransferDataFromWindow(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::transferDataToPad(), DIALOG_SWAP_LAYERS::TransferDataToWindow(), DIALOG_PAD_PROPERTIES::updatePadLayersList(), RATSNEST_VIEW_ITEM::ViewDraw(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ AllLayersMask()

LSET LSET::AllLayersMask ( )
static

Definition at line 796 of file lset.cpp.

797 {
798  static const LSET saved = LSET().set();
799  return saved;
800 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
LSET()
Create an empty (cleared) set.
Definition: layer_ids.h:533

References LSET().

Referenced by PCB_GRID_HELPER::BestDragOrigin(), PCB_GRID_HELPER::BestSnapAnchor(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), DRC_RTREE::DRC_RTREE(), FOOTPRINT_DESC::FOOTPRINT_DESC(), GERBVIEW_FRAME::GERBVIEW_FRAME(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadLayerSet(), GERBVIEW_FRAME::GetVisibleLayers(), APPEARANCE_CONTROLS::getVisibleLayers(), BOARD::GetVisibleLayers(), ROUTER_TOOL::handleLayerSwitch(), LAYER_PRESET::LAYER_PRESET(), CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup(), PCB_EDIT_FRAME::onBoardLoaded(), DIALOG_DRC::OnDRCItemSelected(), PCB_POINT_EDITOR::OnSelectionChange(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS(), PCB_PICKER_TOOL::reset(), PCB_LAYER_BOX_SELECTOR::Resync(), DRC_TEST_PROVIDER_DISALLOW::Run(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), PCB_SELECTION_TOOL::Selectable(), DRAWING_TOOL::SetAnchor(), APPEARANCE_CONTROLS::setVisibleLayers(), DRC_TEST_PROVIDER_MISC::testDisabledLayers(), PANEL_SETUP_LAYERS::testLayerNames(), DRC_TEST_PROVIDER_MISC::testTextVars(), TRACK_VIA_DESC::TRACK_VIA_DESC(), PANEL_SETUP_LAYERS::TransferDataFromWindow(), PCB_EDIT_FRAME::UpdateUserInterface(), PCB_VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ AllNonCuMask()

LSET LSET::AllNonCuMask ( )
static

Return a mask holding all layer minus CU layers.

Definition at line 782 of file lset.cpp.

783 {
784  static const LSET saved = LSET().set() & ~AllCuMask();
785  return saved;
786 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
LSET()
Create an empty (cleared) set.
Definition: layer_ids.h:533

References AllCuMask(), and LSET().

Referenced by DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), BOARD_ADAPTER::createLayers(), CONVERT_TOOL::CreateLines(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), ROUTER_TOOL::handleLayerSwitch(), and DIALOG_SWAP_LAYERS::TransferDataToWindow().

◆ AllTechMask()

LSET LSET::AllTechMask ( )
static

Return a mask holding all technical layers (no CU layer) on both side.

Definition at line 829 of file lset.cpp.

830 {
831  static const LSET saved = BackTechMask() | FrontTechMask();
832  return saved;
833 }
static LSET BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
Definition: lset.cpp:803
static LSET FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
Definition: lset.cpp:815
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

References BackTechMask(), and FrontTechMask().

Referenced by BOARD_ITEM::layerMaskDescribe(), FABMASTER::loadLayers(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_PLOT::OnPopUpLayers(), DRAWING_TOOL::PlaceCharacteristics(), and DRAWING_TOOL::PlaceStackup().

◆ BackAssembly()

LSET LSET::BackAssembly ( )
static

Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.

Definition at line 705 of file lset.cpp.

706 {
707  static const PCB_LAYER_ID back_assembly[] = {
708  B_SilkS,
709  B_Mask,
710  B_Fab,
711  B_CrtYd
712  };
713 
714  static const LSET saved( back_assembly, arrayDim( back_assembly ) );
715  return saved;
716 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

References arrayDim(), B_CrtYd, B_Fab, B_Mask, and B_SilkS.

◆ BackBoardTechMask()

LSET LSET::BackBoardTechMask ( )
static

Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.

Definition at line 809 of file lset.cpp.

810 {
811  static const LSET saved( 4, B_SilkS, B_Mask, B_Adhes, B_Paste );
812  return saved;
813 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

References B_Adhes, B_Mask, B_Paste, and B_SilkS.

Referenced by AllBoardTechMask(), and PAD::FlashLayer().

◆ BackMask()

LSET LSET::BackMask ( )
static

Return a mask holding all technical layers and the external CU layer on back side.

Definition at line 890 of file lset.cpp.

891 {
892  static const LSET saved = BackTechMask().set( B_Cu );
893  return saved;
894 }
static LSET BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
Definition: lset.cpp:803
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

References B_Cu, and BackTechMask().

Referenced by calcIsInsideArea(), DRC_ENGINE::EvalRules(), and DRC_TEST_PROVIDER_SILK_CLEARANCE::Run().

◆ BackTechMask()

LSET LSET::BackTechMask ( )
static

Return a mask holding all technical layers (no CU layer) on back side.

Definition at line 803 of file lset.cpp.

804 {
805  static const LSET saved( 6, B_SilkS, B_Mask, B_Adhes, B_Paste, B_CrtYd, B_Fab );
806  return saved;
807 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

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

Referenced by AllTechMask(), BackMask(), and PCB_VIA::ViewGetLOD().

◆ Contains()

bool LSET::Contains ( PCB_LAYER_ID  aLayer)
inline

See if the layer set contains a PCB layer.

Parameters
aLayeris the layer to check
Returns
true if the layer is included

Definition at line 587 of file layer_ids.h.

588  {
589  try
590  {
591  return test( aLayer );
592  }
593  catch( std::out_of_range& )
594  {
595  return false;
596  }
597  }

Referenced by calcIsInsideArea(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), APPEARANCE_CONTROLS::doApplyLayerPreset(), PCB_LAYER_VALUE::EqualTo(), ZONE_FILLER::Fill(), BOARD_INSPECTION_TOOL::highlightNet(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers(), APPEARANCE_CONTROLS::setVisibleLayers(), and PCB_EDIT_FRAME::UpdateUserInterface().

◆ CuStack()

LSEQ LSET::CuStack ( ) const

Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.

This specific sequence is depended upon in numerous places.

Definition at line 170 of file lset.cpp.

171 {
172  // desired sequence
173  static const PCB_LAYER_ID sequence[] = {
174  F_Cu,
175  In1_Cu,
176  In2_Cu,
177  In3_Cu,
178  In4_Cu,
179  In5_Cu,
180  In6_Cu,
181  In7_Cu,
182  In8_Cu,
183  In9_Cu,
184  In10_Cu,
185  In11_Cu,
186  In12_Cu,
187  In13_Cu,
188  In14_Cu,
189  In15_Cu,
190  In16_Cu,
191  In17_Cu,
192  In18_Cu,
193  In19_Cu,
194  In20_Cu,
195  In21_Cu,
196  In22_Cu,
197  In23_Cu,
198  In24_Cu,
199  In25_Cu,
200  In26_Cu,
201  In27_Cu,
202  In28_Cu,
203  In29_Cu,
204  In30_Cu,
205  B_Cu, // 31
206  };
207 
208  return Seq( sequence, arrayDim( sequence ) );
209 }
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:445
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
Definition: layer_ids.h:71

References arrayDim(), B_Cu, F_Cu, In10_Cu, In11_Cu, In12_Cu, In13_Cu, In14_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In20_Cu, In21_Cu, In22_Cu, In23_Cu, In24_Cu, In25_Cu, In26_Cu, In27_Cu, In28_Cu, In29_Cu, In2_Cu, In30_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, In9_Cu, and Seq().

Referenced by PCB_PLUGIN::formatBoardLayers(), APPEARANCE_CONTROLS::rebuildLayers(), UIOrder(), and HYPERLYNX_EXPORTER::writeStackupInfo().

◆ ExternalCuMask()

LSET LSET::ExternalCuMask ( )
static

Return a mask holding the Front and Bottom layers.

Definition at line 789 of file lset.cpp.

790 {
791  static const LSET saved( 2, F_Cu, B_Cu );
792  return saved;
793 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
Definition: layer_ids.h:71

References B_Cu, and F_Cu.

Referenced by DRC_RULES_PARSER::parseLayer(), BRDITEMS_PLOTTER::PlotPad(), PANEL_SETUP_BOARD_STACKUP::showOnlyActiveLayers(), BOARD_STACKUP::StackupAllowedBrdLayers(), and PANEL_SETUP_BOARD_STACKUP::updateCopperLayerCount().

◆ ExtractLayer()

PCB_LAYER_ID LSET::ExtractLayer ( ) const

Find the first set PCB_LAYER_ID.

Returns UNDEFINED_LAYER if more than one is set or UNSELECTED_LAYER if none is set.

Definition at line 670 of file lset.cpp.

671 {
672  unsigned set_count = count();
673 
674  if( !set_count )
675  return UNSELECTED_LAYER;
676  else if( set_count > 1 )
677  return UNDEFINED_LAYER;
678 
679  for( unsigned i=0; i < size(); ++i )
680  {
681  if( test( i ) )
682  return PCB_LAYER_ID( i );
683  }
684 
685  wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
686 
687  return UNDEFINED_LAYER;
688 }
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

References UNDEFINED_LAYER, and UNSELECTED_LAYER.

Referenced by PCBNEW_PRINTOUT::OnPrintPage().

◆ FmtBin()

std::string LSET::FmtBin ( ) const

Return a binary string showing contents of this LSEQ.

Definition at line 297 of file lset.cpp.

298 {
299  std::string ret;
300 
301  int bit_count = size();
302 
303  for( int bit=0; bit<bit_count; ++bit )
304  {
305  if( bit )
306  {
307  if( !( bit % 8 ) )
308  ret += '|';
309  else if( !( bit % 4 ) )
310  ret += '_';
311  }
312 
313  ret += (*this)[bit] ? '1' : '0';
314  }
315 
316  // reverse of string
317  return std::string( ret.rbegin(), ret.rend() );
318 }

Referenced by ViaSort().

◆ FmtHex()

std::string LSET::FmtHex ( ) const

Return a hex string showing contents of this LSEQ.

Definition at line 321 of file lset.cpp.

322 {
323  std::string ret;
324 
325  static const char hex[] = "0123456789abcdef";
326 
327  size_t nibble_count = ( size() + 3 ) / 4;
328 
329  for( size_t nibble = 0; nibble < nibble_count; ++nibble )
330  {
331  unsigned int ndx = 0;
332 
333  // test 4 consecutive bits and set ndx to 0-15
334  for( size_t nibble_bit = 0; nibble_bit < 4; ++nibble_bit )
335  {
336  size_t nibble_pos = nibble_bit + ( nibble * 4 );
337  // make sure it's not extra bits that don't exist in the bitset but need to in the
338  // hex format
339  if( nibble_pos >= size() )
340  break;
341 
342  if( ( *this )[nibble_pos] )
343  ndx |= ( 1 << nibble_bit );
344  }
345 
346  if( nibble && !( nibble % 8 ) )
347  ret += '_';
348 
349  assert( ndx < arrayDim( hex ) );
350 
351  ret += hex[ndx];
352  }
353 
354  // reverse of string
355  return std::string( ret.rbegin(), ret.rend() );
356 }
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31

References arrayDim().

Referenced by PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS().

◆ ForbiddenFootprintLayers()

LSET LSET::ForbiddenFootprintLayers ( )
static

Layers which are not allowed within footprint definitions.

Currently internal copper layers and Margin.

Definition at line 897 of file lset.cpp.

898 {
899  static const LSET saved = InternalCuMask();
900  return saved;
901 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition: lset.cpp:719

References InternalCuMask().

Referenced by DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), APPEARANCE_CONTROLS::onLayerLeftClick(), APPEARANCE_CONTROLS::rebuildLayers(), and FOOTPRINT_EDIT_FRAME::ReCreateHToolbar().

◆ FrontAssembly()

LSET LSET::FrontAssembly ( )
static

Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.

Definition at line 691 of file lset.cpp.

692 {
693  static const PCB_LAYER_ID front_assembly[] = {
694  F_SilkS,
695  F_Mask,
696  F_Fab,
697  F_CrtYd
698  };
699 
700  static const LSET saved( front_assembly, arrayDim( front_assembly ) );
701  return saved;
702 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

References arrayDim(), F_CrtYd, F_Fab, F_Mask, and F_SilkS.

◆ FrontBoardTechMask()

LSET LSET::FrontBoardTechMask ( )
static

Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.

Definition at line 822 of file lset.cpp.

823 {
824  static const LSET saved( 4, F_SilkS, F_Mask, F_Adhes, F_Paste );
825  return saved;
826 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

References F_Adhes, F_Mask, F_Paste, and F_SilkS.

Referenced by AllBoardTechMask(), and PAD::FlashLayer().

◆ FrontMask()

LSET LSET::FrontMask ( )
static

Return a mask holding all technical layers and the external CU layer on front side.

Definition at line 883 of file lset.cpp.

884 {
885  static const LSET saved = FrontTechMask().set( F_Cu );
886  return saved;
887 }
static LSET FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
Definition: lset.cpp:815
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
Definition: layer_ids.h:71

References F_Cu, and FrontTechMask().

Referenced by calcIsInsideArea(), DRC_ENGINE::EvalRules(), and DRC_TEST_PROVIDER_SILK_CLEARANCE::Run().

◆ FrontTechMask()

LSET LSET::FrontTechMask ( )
static

Return a mask holding all technical layers (no CU layer) on front side.

Definition at line 815 of file lset.cpp.

816 {
817  static const LSET saved( 6, F_SilkS, F_Mask, F_Adhes, F_Paste, F_CrtYd, F_Fab );
818  return saved;
819 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

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

Referenced by AllTechMask(), FrontMask(), and PCB_VIA::ViewGetLOD().

◆ InternalCuMask()

LSET LSET::InternalCuMask ( )
static

Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.

Definition at line 719 of file lset.cpp.

720 {
721  static const PCB_LAYER_ID cu_internals[] = {
722  In1_Cu,
723  In2_Cu,
724  In3_Cu,
725  In4_Cu,
726  In5_Cu,
727  In6_Cu,
728  In7_Cu,
729  In8_Cu,
730  In9_Cu,
731  In10_Cu,
732  In11_Cu,
733  In12_Cu,
734  In13_Cu,
735  In14_Cu,
736  In15_Cu,
737  In16_Cu,
738  In17_Cu,
739  In18_Cu,
740  In19_Cu,
741  In20_Cu,
742  In21_Cu,
743  In22_Cu,
744  In23_Cu,
745  In24_Cu,
746  In25_Cu,
747  In26_Cu,
748  In27_Cu,
749  In28_Cu,
750  In29_Cu,
751  In30_Cu,
752  };
753 
754  static const LSET saved( cu_internals, arrayDim( cu_internals ) );
755  return saved;
756 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

References arrayDim(), In10_Cu, In11_Cu, In12_Cu, In13_Cu, In14_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In20_Cu, In21_Cu, In22_Cu, In23_Cu, In24_Cu, In25_Cu, In26_Cu, In27_Cu, In28_Cu, In29_Cu, In2_Cu, In30_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, and In9_Cu.

Referenced by AllCuMask(), ZONE_FILLER::Fill(), ZONE_FILLER::fillSingleZone(), FlipLayerMask(), ForbiddenFootprintLayers(), ZONE::GetFilledPolysUseThickness(), PCB_PARSER::init(), DIALOG_RULE_AREA_PROPERTIES::OnLayerSelection(), DIALOG_PAD_PROPERTIES::padValuesOK(), DRC_RULES_PARSER::parseLayer(), PANEL_SETUP_LAYERS::setCopperLayerCheckBoxes(), PANEL_SETUP_BOARD_STACKUP::showOnlyActiveLayers(), and BOARD_STACKUP::StackupAllowedBrdLayers().

◆ Name()

const wxChar * LSET::Name ( PCB_LAYER_ID  aLayerId)
static

Return the fixed name association with aLayerId.

NOTE: These names must not be translated or changed.

They are used as tokens in the board file format because the ordinal value of the PCB_LAYER_ID enum was not stable over time.

See also
LayerName() for what should be used to display the default name of a layer in the GUI.

Definition at line 82 of file lset.cpp.

83 {
84  const wxChar* txt;
85 
86  // using a switch to explicitly show the mapping more clearly
87  switch( aLayerId )
88  {
89  case F_Cu: txt = wxT( "F.Cu" ); break;
90  case In1_Cu: txt = wxT( "In1.Cu" ); break;
91  case In2_Cu: txt = wxT( "In2.Cu" ); break;
92  case In3_Cu: txt = wxT( "In3.Cu" ); break;
93  case In4_Cu: txt = wxT( "In4.Cu" ); break;
94  case In5_Cu: txt = wxT( "In5.Cu" ); break;
95  case In6_Cu: txt = wxT( "In6.Cu" ); break;
96  case In7_Cu: txt = wxT( "In7.Cu" ); break;
97  case In8_Cu: txt = wxT( "In8.Cu" ); break;
98  case In9_Cu: txt = wxT( "In9.Cu" ); break;
99  case In10_Cu: txt = wxT( "In10.Cu" ); break;
100  case In11_Cu: txt = wxT( "In11.Cu" ); break;
101  case In12_Cu: txt = wxT( "In12.Cu" ); break;
102  case In13_Cu: txt = wxT( "In13.Cu" ); break;
103  case In14_Cu: txt = wxT( "In14.Cu" ); break;
104  case In15_Cu: txt = wxT( "In15.Cu" ); break;
105  case In16_Cu: txt = wxT( "In16.Cu" ); break;
106  case In17_Cu: txt = wxT( "In17.Cu" ); break;
107  case In18_Cu: txt = wxT( "In18.Cu" ); break;
108  case In19_Cu: txt = wxT( "In19.Cu" ); break;
109  case In20_Cu: txt = wxT( "In20.Cu" ); break;
110  case In21_Cu: txt = wxT( "In21.Cu" ); break;
111  case In22_Cu: txt = wxT( "In22.Cu" ); break;
112  case In23_Cu: txt = wxT( "In23.Cu" ); break;
113  case In24_Cu: txt = wxT( "In24.Cu" ); break;
114  case In25_Cu: txt = wxT( "In25.Cu" ); break;
115  case In26_Cu: txt = wxT( "In26.Cu" ); break;
116  case In27_Cu: txt = wxT( "In27.Cu" ); break;
117  case In28_Cu: txt = wxT( "In28.Cu" ); break;
118  case In29_Cu: txt = wxT( "In29.Cu" ); break;
119  case In30_Cu: txt = wxT( "In30.Cu" ); break;
120  case B_Cu: txt = wxT( "B.Cu" ); break;
121 
122  // Technicals
123  case B_Adhes: txt = wxT( "B.Adhes" ); break;
124  case F_Adhes: txt = wxT( "F.Adhes" ); break;
125  case B_Paste: txt = wxT( "B.Paste" ); break;
126  case F_Paste: txt = wxT( "F.Paste" ); break;
127  case B_SilkS: txt = wxT( "B.SilkS" ); break;
128  case F_SilkS: txt = wxT( "F.SilkS" ); break;
129  case B_Mask: txt = wxT( "B.Mask" ); break;
130  case F_Mask: txt = wxT( "F.Mask" ); break;
131 
132  // Users
133  case Dwgs_User: txt = wxT( "Dwgs.User" ); break;
134  case Cmts_User: txt = wxT( "Cmts.User" ); break;
135  case Eco1_User: txt = wxT( "Eco1.User" ); break;
136  case Eco2_User: txt = wxT( "Eco2.User" ); break;
137  case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
138  case Margin: txt = wxT( "Margin" ); break;
139 
140  // Footprint
141  case F_CrtYd: txt = wxT( "F.CrtYd" ); break;
142  case B_CrtYd: txt = wxT( "B.CrtYd" ); break;
143  case F_Fab: txt = wxT( "F.Fab" ); break;
144  case B_Fab: txt = wxT( "B.Fab" ); break;
145 
146  // User definable layers.
147  case User_1: txt = wxT( "User.1" ); break;
148  case User_2: txt = wxT( "User.2" ); break;
149  case User_3: txt = wxT( "User.3" ); break;
150  case User_4: txt = wxT( "User.4" ); break;
151  case User_5: txt = wxT( "User.5" ); break;
152  case User_6: txt = wxT( "User.6" ); break;
153  case User_7: txt = wxT( "User.7" ); break;
154  case User_8: txt = wxT( "User.8" ); break;
155  case User_9: txt = wxT( "User.9" ); break;
156 
157  // Rescue
158  case Rescue: txt = wxT( "Rescue" ); break;
159 
160  default:
161  std::cout << aLayerId << std::endl;
162  wxASSERT_MSG( 0, wxT( "aLayerId out of range" ) );
163  txt = wxT( "BAD INDEX!" ); break;
164  }
165 
166  return txt;
167 }
Definition: layer_ids.h:71

References B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, In10_Cu, In11_Cu, In12_Cu, In13_Cu, In14_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In20_Cu, In21_Cu, In22_Cu, In23_Cu, In24_Cu, In25_Cu, In26_Cu, In27_Cu, In28_Cu, In29_Cu, In2_Cu, In30_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, In9_Cu, Margin, Rescue, User_1, User_2, User_3, User_4, User_5, User_6, User_7, User_8, and User_9.

Referenced by PANEL_SETUP_LAYERS::addUserDefinedLayer(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_PLUGIN::format(), PCB_PLUGIN::formatBoardLayers(), BOARD_STACKUP::FormatBoardStackup(), PCB_PLUGIN::formatLayer(), PCB_PLUGIN::formatLayers(), PCB_PARSER::init(), CADSTAR_PCB_ARCHIVE_LOADER::logBoardStackupMessage(), CADSTAR_PCB_ARCHIVE_LOADER::logBoardStackupWarning(), FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy(), PCBNEW_SETTINGS::MigrateFromLegacy(), PCB_EDIT_FRAME::onBoardLoaded(), PCBNEW_PRINTOUT::OnPrintPage(), PCB_PARSER::parseLayer(), TRACK_VIA_DESC::TRACK_VIA_DESC(), and PCB_EDIT_FRAME::UpdateUserInterface().

◆ ParseHex()

int LSET::ParseHex ( const char *  aStart,
int  aCount 
)

Convert the output of FmtHex() and replaces this set's values with those given in the input string.

Parsing stops at the first non hex ASCII byte, except that marker bytes output from FmtHex are not terminators.

Returns
int - number of bytes consumed

Definition at line 359 of file lset.cpp.

360 {
361  LSET tmp;
362 
363  const char* rstart = aStart + aCount - 1;
364  const char* rend = aStart - 1;
365 
366  const int bitcount = size();
367 
368  int nibble_ndx = 0;
369 
370  while( rstart > rend )
371  {
372  int cc = *rstart--;
373 
374  if( cc == '_' )
375  continue;
376 
377  int nibble;
378 
379  if( cc >= '0' && cc <= '9' )
380  nibble = cc - '0';
381  else if( cc >= 'a' && cc <= 'f' )
382  nibble = cc - 'a' + 10;
383  else if( cc >= 'A' && cc <= 'F' )
384  nibble = cc - 'A' + 10;
385  else
386  break;
387 
388  int bit = nibble_ndx * 4;
389 
390  for( int ndx=0; bit<bitcount && ndx<4; ++bit, ++ndx )
391  if( nibble & (1<<ndx) )
392  tmp.set( bit );
393 
394  if( bit >= bitcount )
395  break;
396 
397  ++nibble_ndx;
398  }
399 
400  int byte_count = aStart + aCount - 1 - rstart;
401 
402  assert( byte_count >= 0 );
403 
404  if( byte_count > 0 )
405  *this = tmp;
406 
407  return byte_count;
408 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

Referenced by PCB_PLOT_PARAMS_PARSER::Parse(), and PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS().

◆ PhysicalLayersMask()

LSET LSET::PhysicalLayersMask ( )
static

Return a mask holding all layers which are physically realized.

Equivalent to the copper layers + the board tech mask.

Definition at line 858 of file lset.cpp.

859 {
860  static const LSET saved = AllBoardTechMask() | AllCuMask();
861  return saved;
862 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
static LSET AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
Definition: lset.cpp:836

References AllBoardTechMask(), and AllCuMask().

Referenced by KIGFX::PCB_RENDER_SETTINGS::GetColor(), PCB_SELECTION_TOOL::Selectable(), PCB_VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ Seq() [1/2]

LSEQ LSET::Seq ( const PCB_LAYER_ID aWishListSequence,
unsigned  aCount 
) const

Return an LSEQ from the union of this LSET and a desired sequence.

The LSEQ element will be in the same sequence as aWishListSequence if they are present.

Parameters
aWishListSequenceestablishes the order of the returned LSEQ, and the LSEQ will only contain PCB_LAYER_IDs which are present in this set.
aCountis the length of aWishListSequence array.

Definition at line 411 of file lset.cpp.

412 {
413  LSEQ ret;
414 
415 #if defined(DEBUG) && 0
416  LSET dup_detector;
417 
418  for( unsigned i=0; i<aCount; ++i )
419  {
420  PCB_LAYER_ID id = aWishListSequence[i];
421 
422  if( test( id ) )
423  {
424  wxASSERT_MSG( !dup_detector[id], wxT( "Duplicate in aWishListSequence" ) );
425  dup_detector[id] = true;
426 
427  ret.push_back( id );
428  }
429  }
430 #else
431 
432  for( unsigned i=0; i<aCount; ++i )
433  {
434  PCB_LAYER_ID id = aWishListSequence[i];
435 
436  if( test( id ) )
437  ret.push_back( id );
438  }
439 #endif
440 
441  return ret;
442 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:477
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

Referenced by CN_CONNECTIVITY_ALGO::Add(), PANEL_SETUP_LAYERS::addUserDefinedLayer(), calcIsInsideArea(), BOARD_ADAPTER::createLayers(), CreatePadsShapesSection(), DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS(), APPEARANCE_CONTROLS::doApplyLayerPreset(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawVia(), DIALOG_EXPORT_SVG::ExportSVGFile(), ZONE_FILLER::Fill(), PCB_VIA::FlashLayer(), PAD::FlashLayer(), PCB_PLUGIN::format(), PCB_PLUGIN::formatBoardLayers(), GENDRILL_WRITER_BASE::GenDrillReportFile(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), ZONE::GetMsgPanelInfo(), PANEL_SETUP_LAYERS::getNonRemovableLayers(), PANEL_SETUP_LAYERS::getRemovedLayersWithItems(), ZONE::GetSelectMenuText(), ROUTER_TOOL::handleLayerSwitch(), ZONE::InitDataFromSrcInCopyCtor(), BOARD_INSPECTION_TOOL::InspectClearance(), CADSTAR_PCB_ARCHIVE_LOADER::loadDocumentationSymbols(), DIALOG_DRC::OnDRCItemSelected(), APPEARANCE_CONTROLS::OnLayerContextMenu(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), CN_VISITOR::operator()(), DIALOG_PAD_PROPERTIES::padValuesOK(), PlotLayerOutlines(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run(), DRC_ENGINE::RunTests(), PCB_SELECTION_TOOL::Selectable(), ZONE::SetLayerSet(), PCB_VIA::SetLayerSet(), GERBVIEW_PRINTOUT::setupViewLayers(), PCBNEW_PRINTOUT::setupViewLayers(), Technicals(), DRC_TEST_PROVIDER_MISC::testDisabledLayers(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), PCB_EDIT_FRAME::UpdateUserInterface(), RATSNEST_VIEW_ITEM::ViewDraw(), ZONE::ViewGetLayers(), and HYPERLYNX_EXPORTER::writeSinglePadStack().

◆ Seq() [2/2]

LSEQ LSET::Seq ( ) const

Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.

Each LSEQ element will be in the same sequence as in PCB_LAYER_ID and only present in the resultant LSEQ if present in this set. Therefore the sequence is subject to change, use it only when enumeration and not order is important.

Definition at line 445 of file lset.cpp.

446 {
447  LSEQ ret;
448 
449  ret.reserve( size() );
450 
451  for( unsigned i = 0; i < size(); ++i )
452  {
453  if( test( i ) )
454  ret.push_back( PCB_LAYER_ID( i ) );
455  }
456 
457  return ret;
458 }
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:477
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

Referenced by CuStack(), SeqStackupBottom2Top(), TechAndUserUIOrder(), and Users().

◆ SeqStackupBottom2Top()

LSEQ LSET::SeqStackupBottom2Top ( ) const

Return the sequence that is typical for a bottom-to-top stack-up.

For instance, to plot multiple layers in a single image, the top layers output last.

Definition at line 461 of file lset.cpp.

462 {
463  // bottom-to-top stack-up layers
464  static const PCB_LAYER_ID sequence[] = {
465  User_9,
466  User_8,
467  User_7,
468  User_6,
469  User_5,
470  User_4,
471  User_3,
472  User_2,
473  User_1,
474  B_Fab,
475  B_CrtYd,
476  B_Adhes,
477  B_SilkS,
478  B_Paste,
479  B_Mask,
480  B_Cu,
481  In30_Cu,
482  In29_Cu,
483  In28_Cu,
484  In27_Cu,
485  In26_Cu,
486  In25_Cu,
487  In24_Cu,
488  In23_Cu,
489  In22_Cu,
490  In21_Cu,
491  In20_Cu,
492  In19_Cu,
493  In18_Cu,
494  In17_Cu,
495  In16_Cu,
496  In15_Cu,
497  In14_Cu,
498  In13_Cu,
499  In12_Cu,
500  In11_Cu,
501  In10_Cu,
502  In9_Cu,
503  In8_Cu,
504  In7_Cu,
505  In6_Cu,
506  In5_Cu,
507  In4_Cu,
508  In3_Cu,
509  In2_Cu,
510  In1_Cu,
511  F_Cu,
512  F_Mask,
513  F_Paste,
514  F_SilkS,
515  F_Adhes,
516  F_CrtYd,
517  F_Fab,
518  Dwgs_User,
519  Cmts_User,
520  Eco1_User,
521  Eco2_User,
522  Margin,
523  Edge_Cuts,
524  };
525 
526  return Seq( sequence, arrayDim( sequence ) );
527 }
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:445
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
Definition: layer_ids.h:71

References arrayDim(), B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, In10_Cu, In11_Cu, In12_Cu, In13_Cu, In14_Cu, In15_Cu, In16_Cu, In17_Cu, In18_Cu, In19_Cu, In1_Cu, In20_Cu, In21_Cu, In22_Cu, In23_Cu, In24_Cu, In25_Cu, In26_Cu, In27_Cu, In28_Cu, In29_Cu, In2_Cu, In30_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu, In7_Cu, In8_Cu, In9_Cu, Margin, Seq(), User_1, User_2, User_3, User_4, User_5, User_6, User_7, User_8, and User_9.

Referenced by DIALOG_EXPORT_SVG::CreateSVGFile().

◆ TechAndUserUIOrder()

LSEQ LSET::TechAndUserUIOrder ( ) const

Returns the technical and user layers in the order shown in layer widget.

Definition at line 261 of file lset.cpp.

262 {
263  static const PCB_LAYER_ID sequence[] = {
264  F_Adhes,
265  B_Adhes,
266  F_Paste,
267  B_Paste,
268  F_SilkS,
269  B_SilkS,
270  F_Mask,
271  B_Mask,
272  Dwgs_User,
273  Cmts_User,
274  Eco1_User,
275  Eco2_User,
276  Edge_Cuts,
277  Margin,
278  F_CrtYd,
279  B_CrtYd,
280  F_Fab,
281  B_Fab,
282  User_1,
283  User_2,
284  User_3,
285  User_4,
286  User_5,
287  User_6,
288  User_7,
289  User_8,
290  User_9
291  };
292 
293  return Seq( sequence, arrayDim( sequence ) );
294 }
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:445
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

References arrayDim(), B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, Margin, Seq(), User_1, User_2, User_3, User_4, User_5, User_6, User_7, User_8, and User_9.

Referenced by UIOrder().

◆ Technicals()

LSEQ LSET::Technicals ( LSET  aSubToOmit = LSET()) const

Return a sequence of technical layers.

A sequence provides a certain order.

Parameters
aSubToOmitis the subset of the technical layers to omit, defaults to none.

Definition at line 212 of file lset.cpp.

213 {
214  // desired sequence
215  static const PCB_LAYER_ID sequence[] = {
216  F_Adhes,
217  B_Adhes,
218  F_Paste,
219  B_Paste,
220  F_SilkS,
221  B_SilkS,
222  F_Mask,
223  B_Mask,
224  F_CrtYd,
225  B_CrtYd,
226  F_Fab,
227  B_Fab,
228  };
229 
230  LSET subset = ~aSetToOmit & *this;
231 
232  return subset.Seq( sequence, arrayDim( sequence ) );
233 }
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

References arrayDim(), B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, and Seq().

◆ UIOrder()

LSEQ LSET::UIOrder ( ) const

Definition at line 904 of file lset.cpp.

905 {
906  LSEQ order = CuStack();
907  LSEQ techuser = TechAndUserUIOrder();
908  order.insert( order.end(), techuser.begin(), techuser.end() );
909 
910  return order;
911 }
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:170
LSEQ TechAndUserUIOrder() const
Returns the technical and user layers in the order shown in layer widget.
Definition: lset.cpp:261
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:477

References CuStack(), and TechAndUserUIOrder().

Referenced by PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), PAD_TOOL::explodePad(), DIALOG_PLOT::init_Dialog(), DIALOG_EXPORT_SVG::initDialog(), GERBVIEW_PRINTOUT::OnPrintPage(), PCBNEW_PRINTOUT::OnPrintPage(), DIALOG_PLOT::Plot(), PAD_TOOL::recombinePad(), PCB_LAYER_BOX_SELECTOR::Resync(), ZONE_SETTINGS::SetupLayersList(), and DIALOG_PRINT_PCBNEW::TransferDataToWindow().

◆ UserDefinedLayers()

LSET LSET::UserDefinedLayers ( )
static

Return a mask with all of the allowable user defined layers.

Definition at line 865 of file lset.cpp.

866 {
867  static const LSET saved( 9,
868  User_1,
869  User_2,
870  User_3,
871  User_4,
872  User_5,
873  User_6,
874  User_7,
875  User_8,
876  User_9
877  );
878 
879  return saved;
880 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

References User_1, User_2, User_3, User_4, User_5, User_6, User_7, User_8, and User_9.

Referenced by PANEL_SETUP_LAYERS::addUserDefinedLayer(), CADSTAR_PCB_ARCHIVE_LOADER::remapUnsureLayers(), PANEL_SETUP_LAYERS::setUserDefinedLayerCheckBoxes(), and PANEL_SETUP_LAYERS::TransferDataFromWindow().

◆ UserMask()

LSET LSET::UserMask ( )
static

Definition at line 843 of file lset.cpp.

844 {
845  static const LSET saved( 6,
846  Dwgs_User,
847  Cmts_User,
848  Eco1_User,
849  Eco2_User,
850  Edge_Cuts,
851  Margin
852  );
853 
854  return saved;
855 }
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516

References Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, and Margin.

Referenced by FABMASTER::loadLayers(), and CADSTAR_PCB_ARCHIVE_LOADER::remapUnsureLayers().

◆ Users()

LSEQ LSET::Users ( ) const

*_User layers.

Definition at line 236 of file lset.cpp.

237 {
238  // desired
239  static const PCB_LAYER_ID sequence[] = {
240  Dwgs_User,
241  Cmts_User,
242  Eco1_User,
243  Eco2_User,
244  Edge_Cuts,
245  Margin,
246  User_1,
247  User_2,
248  User_3,
249  User_4,
250  User_5,
251  User_6,
252  User_7,
253  User_8,
254  User_9
255  };
256 
257  return Seq( sequence, arrayDim( sequence ) );
258 }
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:445
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65

References arrayDim(), Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, Margin, Seq(), User_1, User_2, User_3, User_4, User_5, User_6, User_7, User_8, and User_9.


The documentation for this class was generated from the following files: