95        std::swap( start, 
end );
 
  103            return aCopperLayerCount;
 
  105            return ( 
end - start ) / 2 - 1;
 
  107    else if ( aEnd == 
B_Cu )
 
  110        return aCopperLayerCount - start / 2 + 1;
 
  113    return ( 
end - start ) / 2;
 
 
  119    std::map<wxString, PCB_LAYER_ID> layerMap = {
 
  144    if( 
auto it = layerMap.find( aName ); it != layerMap.end() )
 
  145        return static_cast<int>( it->second );
 
  147    if( aName.StartsWith( 
"User." ) )
 
  151        if( aName.Mid( 5 ).ToLong( &offset ) && offset > 0 )
 
  152            return static_cast<int>( 
User_1 ) + ( offset - 1 ) * 2;
 
  155    if( aName.StartsWith( 
"In" ) )
 
  158        wxString str_num = aName.Mid( 2 );
 
  159        str_num.RemoveLast( 3 ); 
 
  161        if( str_num.ToLong( &offset ) && offset > 0 )
 
  162            return static_cast<int>( 
In1_Cu ) + ( offset - 1 ) * 2;
 
 
  171    if( aLayer == aStart || aLayer == aEnd )
 
  174    int start = std::min( aStart, aEnd );
 
  175    int end = std::max( aStart, aEnd );
 
  181        end = std::numeric_limits<PCB_LAYER_ID>::max() & ~1;
 
  184    return !( layer & 1 ) && ( layer >= start ) && ( layer <= 
end );
 
 
  195    case F_Cu:              txt = wxT( 
"F.Cu" );            
break;
 
  196    case B_Cu:              txt = wxT( 
"B.Cu" );            
break;
 
  199    case B_Adhes:           txt = wxT( 
"B.Adhes" );         
break;
 
  200    case F_Adhes:           txt = wxT( 
"F.Adhes" );         
break;
 
  201    case B_Paste:           txt = wxT( 
"B.Paste" );         
break;
 
  202    case F_Paste:           txt = wxT( 
"F.Paste" );         
break;
 
  203    case B_SilkS:           txt = wxT( 
"B.SilkS" );         
break;
 
  204    case F_SilkS:           txt = wxT( 
"F.SilkS" );         
break;
 
  205    case B_Mask:            txt = wxT( 
"B.Mask" );          
break;
 
  206    case F_Mask:            txt = wxT( 
"F.Mask" );          
break;
 
  209    case Dwgs_User:         txt = wxT( 
"Dwgs.User" );       
break;
 
  210    case Cmts_User:         txt = wxT( 
"Cmts.User" );       
break;
 
  211    case Eco1_User:         txt = wxT( 
"Eco1.User" );       
break;
 
  212    case Eco2_User:         txt = wxT( 
"Eco2.User" );       
break;
 
  213    case Edge_Cuts:         txt = wxT( 
"Edge.Cuts" );       
break;
 
  214    case Margin:            txt = wxT( 
"Margin" );          
break;
 
  217    case F_CrtYd:           txt = wxT( 
"F.CrtYd" );         
break;
 
  218    case B_CrtYd:           txt = wxT( 
"B.CrtYd" );         
break;
 
  219    case F_Fab:             txt = wxT( 
"F.Fab" );           
break;
 
  220    case B_Fab:             txt = wxT( 
"B.Fab" );           
break;
 
  223    case Rescue:            txt = wxT( 
"Rescue" );          
break;
 
  228            txt = wxT( 
"UNDEFINED" );
 
  230        else if( 
static_cast<int>( aLayerId ) & 1 )
 
  232            int offset = ( aLayerId - 
Rescue ) / 2;
 
  233            txt = wxString::Format( wxT( 
"User.%d" ), offset );
 
  237            int offset = ( aLayerId - 
B_Cu ) / 2;
 
  238            txt = wxString::Format( wxT( 
"In%d.Cu" ), offset );
 
 
  253        ret.push_back( *it );
 
 
  289            ret.push_back( *it );
 
 
  303            ret.push_back( layer );
 
 
  314    ret.reserve( size() );
 
  316    for( 
unsigned i = 0; i < size(); ++i )
 
 
  337    LSEQ top_tech_sequence = 
Seq( {
 
  346    LSEQ bottom_tech_sequence = 
Seq( {
 
  356    LSEQ seq = 
Seq( base_sequence );
 
  361            seq.push_back( *it );
 
  364    std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
 
  367        seq.push_back( *it );
 
  369    std::copy( bottom_tech_sequence.begin(), bottom_tech_sequence.end(),
 
  370               std::back_inserter( seq ) );
 
  374        auto it = std::find( seq.begin(), seq.end(), aSelectedLayer );
 
  376        if( it != seq.end() )
 
  379            seq.insert( seq.begin(), aSelectedLayer );
 
 
  392    LSEQ bottom_tech_sequence = 
Seq( {
 
  404    LSEQ top_tech_sequence = 
Seq( {
 
  429    LSEQ seq = 
Seq( bottom_tech_sequence );
 
  431    std::vector<PCB_LAYER_ID> temp_layers;
 
  439            temp_layers.push_back( *it );
 
  442    for( 
auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
 
  443        seq.push_back( *it );
 
  445    std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
 
  447    std::copy( user_sequence.begin(), user_sequence.end(), std::back_inserter( seq ) );
 
  454            temp_layers.push_back( *it );
 
  457    for( 
auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
 
  459        seq.push_back( *it );
 
  462    std::copy( base_sequence.begin(), base_sequence.end(), std::back_inserter( seq ) );
 
 
  470    LSET oldMask = *
this;
 
  475    const std::map<PCB_LAYER_ID, PCB_LAYER_ID> flip_map =
 
  493    for( 
const auto& pair : flip_map )
 
  495        if( oldMask.test( pair.first ) )
 
  498        oldMask.
set( pair.first, 
false );
 
  501    if( aCopperLayersCount >= 4 )
 
  504        int  innerLayerCount = aCopperLayersCount - 2;
 
  506        for( 
int ii = 1; ii <= innerLayerCount; ii++ )
 
  508            if( internalMask.test( ( innerLayerCount - ii + 1 ) * 2 + 
B_Cu ) )
 
 
  527    unsigned set_count = count();
 
  531    else if( set_count > 1 )
 
  534    for( 
unsigned i=0; i < size(); ++i )
 
 
  692    for( 
int ulayer = 1; ulayer <= aUserDefinedLayerCount; ulayer++ )
 
  694        if( layer > ret.size() )
 
 
  731    order.insert( order.end(), techuser.begin(), techuser.end() );
 
 
  740    if( aLayer == std::numeric_limits<int>::max() )
 
 
  750    for( 
unsigned i = 0; i < aCount; ++i )
 
 
  757    std::vector<GAL_LAYER_ID> ret;
 
  759    for( 
size_t i = 0; i < size(); ++i )
 
 
  927    for( 
size_t ii = 0; ii < size(); ii += 2 )
 
 
  936    for( 
size_t ii = 1; ii < size(); ii += 2 )
 
 
  945    for( 
size_t ii = 
User_1; ii < size(); ii += 2 )
 
 
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
 
const BASE_SET & m_baseSet
 
set_bits_iterator(const BASE_SET &baseSet, size_t index)
 
BASE_SET & reset(size_t pos)
 
BASE_SET & set(size_t pos)
 
static GAL_SET DefaultVisible()
 
std::vector< GAL_LAYER_ID > Seq() const
 
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
 
copper_layers_iterator & operator++()
 
PCB_LAYER_ID operator*() const
 
void advance_to_next_set_copper_bit()
 
copper_layers_iterator(const BASE_SET &set, size_t index)
 
void advance_to_next_set_non_copper_bit()
 
PCB_LAYER_ID operator*() const
 
non_copper_layers_iterator & operator++()
 
non_copper_layers_iterator(const BASE_SET &set, size_t index)
 
LSET is a set of PCB_LAYER_IDs.
 
static bool IsBetween(PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd, PCB_LAYER_ID aLayer)
Return true if aLayer is between aStart and aEnd, inclusive.
 
static const LSET & FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
 
static const LSET & AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
 
static const LSET & BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
 
copper_layers_iterator copper_layers_end() const
 
static const LSET & FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
 
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
 
static const LSET & BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
 
static const LSET & FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
 
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 AllNonCuMask()
Return a mask holding all layer minus CU layers.
 
LSEQ TechAndUserUIOrder() const
Return the technical and user layers in the order shown in layer widget.
 
static const LSET & BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
 
static const LSET & UserMask()
 
LSET & ClearUserDefinedLayers()
Clear the user defined layers in this set.
 
static const LSET & SideSpecificMask()
 
LSET & ClearNonCopperLayers()
Clear the non-copper layers in this set.
 
all_set_layers_iterator end() const
 
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
 
static const LSET & ExternalCuMask()
Return a mask holding the Front and Bottom layers.
 
copper_layers_iterator copper_layers_begin() const
 
non_copper_layers_iterator non_copper_layers_begin() const
 
LSET & FlipStandardLayers(int aCopperLayersCount=0)
Flip the layers in this set.
 
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
 
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
 
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.
 
non_copper_layers_iterator non_copper_layers_end() const
 
LSET & ClearCopperLayers()
Clear the copper layers in this set.
 
static const LSET & AllLayersMask()
 
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
 
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
 
static const LSET & PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
 
static const LSET & BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
 
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
 
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
 
LSET()
Create an empty (cleared) set.
 
static int LayerCount(PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd, int aCopperLayerCount)
Return the number of layers between aStart and aEnd, inclusive.
 
static const LSET & FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
 
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
 
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
 
@ LAYER_POINTS
PCB reference/manual snap points visibility.
 
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
 
@ LAYER_FILLED_SHAPES
Copper graphic shape opacity/visibility (color ignored).
 
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
 
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
 
@ LAYER_NON_PLATEDHOLES
Draw usual through hole vias.
 
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
 
@ LAYER_DRAW_BITMAPS
Draw images.
 
@ 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_DRC_SHAPES
Custom shapes for DRC markers.
 
@ 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_VIA_BURIED
Draw blind vias.
 
@ LAYER_VIA_HOLES
Draw via holes (pad holes do not use this layer).
 
@ LAYER_VIA_BLIND
Draw micro vias.
 
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
 
@ LAYER_SELECT_OVERLAY
Selected items overlay.
 
@ LAYER_VIA_THROUGH
Draw buried vias.
 
@ LAYER_DRC_ERROR
Layer for DRC markers with #SEVERITY_ERROR.
 
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
 
PCB_LAYER_ID
A quick note on layer IDs:
 
LSET allCuMask(int aCuLayerCount)
 
PCB_LAYER_ID ToLAYER_ID(int aLayer)
 
This file contains miscellaneous commonly used macros and functions.