70 case F_Cu: txt = wxT(
"F.Cu" );
break;
71 case In1_Cu: txt = wxT(
"In1.Cu" );
break;
72 case In2_Cu: txt = wxT(
"In2.Cu" );
break;
73 case In3_Cu: txt = wxT(
"In3.Cu" );
break;
74 case In4_Cu: txt = wxT(
"In4.Cu" );
break;
75 case In5_Cu: txt = wxT(
"In5.Cu" );
break;
76 case In6_Cu: txt = wxT(
"In6.Cu" );
break;
77 case In7_Cu: txt = wxT(
"In7.Cu" );
break;
78 case In8_Cu: txt = wxT(
"In8.Cu" );
break;
79 case In9_Cu: txt = wxT(
"In9.Cu" );
break;
80 case In10_Cu: txt = wxT(
"In10.Cu" );
break;
81 case In11_Cu: txt = wxT(
"In11.Cu" );
break;
82 case In12_Cu: txt = wxT(
"In12.Cu" );
break;
83 case In13_Cu: txt = wxT(
"In13.Cu" );
break;
84 case In14_Cu: txt = wxT(
"In14.Cu" );
break;
85 case In15_Cu: txt = wxT(
"In15.Cu" );
break;
86 case In16_Cu: txt = wxT(
"In16.Cu" );
break;
87 case In17_Cu: txt = wxT(
"In17.Cu" );
break;
88 case In18_Cu: txt = wxT(
"In18.Cu" );
break;
89 case In19_Cu: txt = wxT(
"In19.Cu" );
break;
90 case In20_Cu: txt = wxT(
"In20.Cu" );
break;
91 case In21_Cu: txt = wxT(
"In21.Cu" );
break;
92 case In22_Cu: txt = wxT(
"In22.Cu" );
break;
93 case In23_Cu: txt = wxT(
"In23.Cu" );
break;
94 case In24_Cu: txt = wxT(
"In24.Cu" );
break;
95 case In25_Cu: txt = wxT(
"In25.Cu" );
break;
96 case In26_Cu: txt = wxT(
"In26.Cu" );
break;
97 case In27_Cu: txt = wxT(
"In27.Cu" );
break;
98 case In28_Cu: txt = wxT(
"In28.Cu" );
break;
99 case In29_Cu: txt = wxT(
"In29.Cu" );
break;
100 case In30_Cu: txt = wxT(
"In30.Cu" );
break;
101 case B_Cu: txt = wxT(
"B.Cu" );
break;
104 case B_Adhes: txt = wxT(
"B.Adhes" );
break;
105 case F_Adhes: txt = wxT(
"F.Adhes" );
break;
106 case B_Paste: txt = wxT(
"B.Paste" );
break;
107 case F_Paste: txt = wxT(
"F.Paste" );
break;
108 case B_SilkS: txt = wxT(
"B.SilkS" );
break;
109 case F_SilkS: txt = wxT(
"F.SilkS" );
break;
110 case B_Mask: txt = wxT(
"B.Mask" );
break;
111 case F_Mask: txt = wxT(
"F.Mask" );
break;
114 case Dwgs_User: txt = wxT(
"Dwgs.User" );
break;
115 case Cmts_User: txt = wxT(
"Cmts.User" );
break;
116 case Eco1_User: txt = wxT(
"Eco1.User" );
break;
117 case Eco2_User: txt = wxT(
"Eco2.User" );
break;
118 case Edge_Cuts: txt = wxT(
"Edge.Cuts" );
break;
119 case Margin: txt = wxT(
"Margin" );
break;
122 case F_CrtYd: txt = wxT(
"F.CrtYd" );
break;
123 case B_CrtYd: txt = wxT(
"B.CrtYd" );
break;
124 case F_Fab: txt = wxT(
"F.Fab" );
break;
125 case B_Fab: txt = wxT(
"B.Fab" );
break;
128 case User_1: txt = wxT(
"User.1" );
break;
129 case User_2: txt = wxT(
"User.2" );
break;
130 case User_3: txt = wxT(
"User.3" );
break;
131 case User_4: txt = wxT(
"User.4" );
break;
132 case User_5: txt = wxT(
"User.5" );
break;
133 case User_6: txt = wxT(
"User.6" );
break;
134 case User_7: txt = wxT(
"User.7" );
break;
135 case User_8: txt = wxT(
"User.8" );
break;
136 case User_9: txt = wxT(
"User.9" );
break;
139 case Rescue: txt = wxT(
"Rescue" );
break;
142 std::cout << aLayerId << std::endl;
143 wxASSERT_MSG( 0, wxT(
"aLayerId out of range" ) );
144 txt = wxT(
"BAD INDEX!" );
break;
211 LSET subset = ~aSetToOmit & *
this;
213 return subset.
Seq( sequence,
arrayDim( sequence ) );
282 int bit_count =
size();
284 for(
int bit=0; bit<bit_count; ++bit )
290 else if( !( bit % 4 ) )
294 ret += (*this)[bit] ?
'1' :
'0';
298 return std::string( ret.rbegin(), ret.rend() );
306 static const char hex[] =
"0123456789abcdef";
308 size_t nibble_count = (
size() + 3 ) / 4;
310 for(
size_t nibble = 0; nibble < nibble_count; ++nibble )
312 unsigned int ndx = 0;
315 for(
size_t nibble_bit = 0; nibble_bit < 4; ++nibble_bit )
317 size_t nibble_pos = nibble_bit + ( nibble * 4 );
320 if( nibble_pos >=
size() )
323 if( ( *
this )[nibble_pos] )
324 ndx |= ( 1 << nibble_bit );
327 if( nibble && !( nibble % 8 ) )
336 return std::string( ret.rbegin(), ret.rend() );
344 const char* rstart = aStart + aCount - 1;
345 const char* rend = aStart - 1;
347 const int bitcount =
size();
351 while( rstart > rend )
360 if( cc >=
'0' && cc <=
'9' )
362 else if( cc >=
'a' && cc <=
'f' )
363 nibble = cc -
'a' + 10;
364 else if( cc >=
'A' && cc <=
'F' )
365 nibble = cc -
'A' + 10;
369 int bit = nibble_ndx * 4;
371 for(
int ndx=0; bit<bitcount && ndx<4; ++bit, ++ndx )
372 if( nibble & (1<<ndx) )
375 if( bit >= bitcount )
381 int byte_count = aStart + aCount - 1 - rstart;
383 assert( byte_count >= 0 );
396#if defined(DEBUG) && 0
399 for(
unsigned i=0; i<aCount; ++i )
405 wxASSERT_MSG( !dup_detector[
id], wxT(
"Duplicate in aWishListSequence" ) );
406 dup_detector[id] =
true;
413 for(
unsigned i=0; i<aCount; ++i )
433 ret.push_back( layer );
444 ret.reserve(
size() );
446 for(
unsigned i = 0; i <
size(); ++i )
524 auto it = std::find( seq.begin(), seq.end(), aSelectedLayer );
526 if( it != seq.end() )
529 seq.insert( seq.begin(), aSelectedLayer );
610 LSET oldMask = *
this;
662 if( aCopperLayersCount >= 4 )
665 int innerLayerCnt = aCopperLayersCount - 2;
669 for(
int ii = 0; ii < innerLayerCnt; ii++ )
671 if( internalMask[innerLayerCnt - ii] )
688 unsigned set_count =
count();
692 else if( set_count > 1 )
695 for(
unsigned i=0; i <
size(); ++i )
746 for(
int elem =
In30_Cu; clear_count; --elem, --clear_count )
747 ret.
set( elem,
false );
755 static const LSET saved =
LSET().set() & ~AllCuMask();
769 static const LSET saved =
LSET().set();
831 static const LSET saved(
869 order.insert( order.end(), techuser.begin(), techuser.end() );
884 for(
unsigned i = 0; i < aCount; ++i )
891 std::vector<GAL_LAYER_ID> ret;
893 for(
size_t i = 0; i < size(); ++i )
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
BASE_SET & set(size_t pos=std::numeric_limits< size_t >::max(), bool value=true)
bool test(size_t pos) const
BASE_SET & reset(size_t pos=std::numeric_limits< size_t >::max())
Helper for storing and iterating over GAL_LAYER_IDs.
static GAL_SET DefaultVisible()
std::vector< GAL_LAYER_ID > Seq() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
LSET & Flip(int aCopperLayersCount=0)
Flip the layers in this set.
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
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.
static LSET AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
static LSET AllLayersMask()
static LSET UserDefinedLayers()
Return a mask with all of the allowable user defined layers.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
static LSET FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
static LSET FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
LSEQ TechAndUserUIOrder() const
Returns the technical and user layers in the order shown in layer widget.
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static LSET SideSpecificMask()
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
std::string FmtHex() const
Return a hex string showing contents of this LSEQ.
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
LSEQ Technicals(LSET aSubToOmit=LSET()) const
Return a sequence of technical layers.
LSEQ SeqStackupTop2Bottom(PCB_LAYER_ID aSelectedLayer=UNDEFINED_LAYER) const
Generate a sequence of layers that represent a top to bottom stack of this set of layers.
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
std::string FmtBin() const
Return a binary string showing contents of this LSEQ.
static LSET FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
static LSET BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
LSEQ Users() const
*_User layers.
static LSET BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
static LSET BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
LSET()
Create an empty (cleared) set.
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
@ LAYER_LOCKED_ITEM_SHADOW
shadow layer for locked items
@ LAYER_CONFLICTS_SHADOW
shadow layer for items flagged conficting
@ LAYER_FOOTPRINTS_FR
show footprints on front
@ LAYER_NON_PLATEDHOLES
handle color for not plated holes (holes, not pads)
@ LAYER_DRAWINGSHEET
drawingsheet frame and titleblock
@ LAYER_DRAW_BITMAPS
to handle and draw images bitmaps
@ LAYER_FP_REFERENCES
show footprints references (when texts are visible)
@ LAYER_PCB_BACKGROUND
PCB background color.
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored)
@ LAYER_SHAPES
Copper graphic shape opacity/visibility (color ignored)
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored)
@ LAYER_DRC_WARNING
layer for drc markers with SEVERITY_WARNING
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
@ LAYER_GP_OVERLAY
general purpose overlay
@ LAYER_CURSOR
PCB cursor.
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc)
@ LAYER_FOOTPRINTS_BK
show footprints on back
@ LAYER_ANCHOR
anchor of items having an anchor point (texts, footprints)
@ LAYER_PADS_SMD_BK
smd pads, back layer
@ LAYER_PADS_TH
multilayer pads, usually with holes
@ LAYER_PADS_SMD_FR
smd pads, front layer
@ LAYER_VIA_HOLES
to draw via holes (pad holes do not use this layer)
@ LAYER_FP_VALUES
show footprints values (when texts are visible)
@ LAYER_VIA_MICROVIA
to draw micro vias
@ LAYER_SELECT_OVERLAY
currently selected items overlay
@ LAYER_VIA_THROUGH
to draw usual through hole vias
@ LAYER_DRC_ERROR
layer for drc markers with SEVERITY_ERROR
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
@ LAYER_VIA_BBLIND
to draw blind/buried vias
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
constexpr T Clamp(const T &lower, const T &value, const T &upper)
Limit value within the range lower <= value <= upper.