Go to the documentation of this file.
31 #ifndef LAYERS_ID_AND_VISIBILITY_H_
32 #define LAYERS_ID_AND_VISIBILITY_H_
74 UNSELECTED_LAYER = -2,
76 PCBNEW_LAYER_ID_START = 0,
77 F_Cu = PCBNEW_LAYER_ID_START,
140 #define MAX_CU_LAYERS (B_Cu - F_Cu + 1)
146 NETNAMES_LAYER_ID_START = PCB_LAYER_ID_COUNT,
155 LAYER_PAD_BK_NETNAMES,
159 NETNAMES_LAYER_ID_END
163 #define NETNAMES_LAYER_INDEX( layer ) ( NETNAMES_LAYER_ID_START + layer )
169 GAL_LAYER_ID_START = NETNAMES_LAYER_ID_END,
171 LAYER_VIAS = GAL_LAYER_ID_START,
213 #define GAL_LAYER_INDEX( x ) ( x - GAL_LAYER_ID_START )
234 LAYER_WIRE = SCH_LAYER_ID_START,
256 LAYER_DEVICE_BACKGROUND,
257 LAYER_SHEET_BACKGROUND,
258 LAYER_SCHEMATIC_BITMAPS,
259 LAYER_SCHEMATIC_GRID,
260 LAYER_SCHEMATIC_BACKGROUND,
261 LAYER_SCHEMATIC_CURSOR,
268 #define SCH_LAYER_ID_COUNT ( SCH_LAYER_ID_END - SCH_LAYER_ID_START )
270 #define SCH_LAYER_INDEX( x ) ( x - SCH_LAYER_ID_START )
279 #define GERBER_DRAWLAYERS_COUNT PCB_LAYER_ID_COUNT
284 GERBVIEW_LAYER_ID_START = SCH_LAYER_ID_END,
290 LAYER_NEGATIVE_OBJECTS,
293 LAYER_GERBVIEW_BACKGROUND,
295 GERBVIEW_LAYER_ID_END
298 #define GERBER_DRAW_LAYER( x ) ( GERBVIEW_LAYER_ID_START + x )
300 #define GERBER_DCODE_LAYER( x ) ( GERBER_DRAWLAYERS_COUNT + x )
302 #define GERBER_DRAW_LAYER_INDEX( x ) ( x - GERBVIEW_LAYER_ID_START )
305 #define LAYER_ID_COUNT GERBVIEW_LAYER_ID_END
312 #define MIN_VISIBILITY_MASK int( ( 1 << GAL_LAYER_INDEX( LAYER_PADS_PLATEDHOLES ) ) +\
313 ( 1 << GAL_LAYER_INDEX( LAYER_VIAS_HOLES ) ) +\
314 ( 1 << GAL_LAYER_INDEX( LAYER_DRC ) ) +\
315 ( 1 << GAL_LAYER_INDEX( LAYER_SELECT_OVERLAY ) ) +\
316 ( 1 << GAL_LAYER_INDEX( LAYER_GP_OVERLAY ) ) )
350 template <
class InputIterator>
351 LSEQ( InputIterator aStart, InputIterator aEnd ) :
352 BASE_SEQ( aStart, aEnd ), m_index( 0 )
355 void Rewind() { m_index = 0; }
357 void operator ++ () { ++m_index; }
359 void operator ++ (
int) { ++m_index; }
361 operator bool () {
return m_index < size(); }
365 return at( m_index );
370 typedef std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;
403 LSET(
const BASE_SET& aOther ) :
447 LSET(
unsigned aIdCount,
int aFirst, ... );
480 static LSET AllLayersMask();
532 static LSET UserMask();
570 LSEQ UIOrder()
const;
629 LSET(
unsigned long __val )
646 return unsigned( aLayerId ) < PCB_LAYER_ID_COUNT;
657 return aLayer >= F_Cu && aLayer < PCB_LAYER_ID_COUNT;
668 return aLayerId >= F_Cu && aLayerId <= B_Cu;
679 return aLayerId > B_Cu && aLayerId <= PCB_LAYER_ID_COUNT;
690 return aLayerId >= Dwgs_User && aLayerId <= Eco2_User;
780 return LAYER_PADS_NETNAMES;
784 return LAYER_PAD_BK_NETNAMES;
786 return LAYER_VIAS_NETNAMES;
801 aLayer < NETNAMES_LAYER_ID_END;
805 inline bool IsDCodeLayer(
int aLayer )
807 return aLayer >= (GERBVIEW_LAYER_ID_START + GERBER_DRAWLAYERS_COUNT) &&
808 aLayer < (GERBVIEW_LAYER_ID_START + (2 * GERBER_DRAWLAYERS_COUNT));
814 #endif // LAYERS_ID_AND_VISIBILITY_H_
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
Definition: layers_id_colors_and_visibility.h:666
static LSET FrontMask()
Function FrontMask returns a mask holding all technical layers and the external CU layer on front sid...
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layers_id_colors_and_visibility.h:341
std::string FmtBin() const
Function FmtBin returns a binary string showing contents of this LSEQ.
@ LAYER_NON_PLATEDHOLES
handle color for not plated holes (holes, not pads)
Definition: layers_id_colors_and_visibility.h:175
std::vector< PCB_LAYER_ID > BASE_SEQ
A sequence of layers, a sequence provides a certain order.
Definition: layers_id_colors_and_visibility.h:320
static const char * Name(PCB_LAYER_ID aLayerId)
Function Name returns the fixed name association with aLayerId.
bool IsNonCopperLayer(LAYER_NUM aLayerId)
Function IsNonCopperLayer tests whether a layer is a non copper layer.
Definition: layers_id_colors_and_visibility.h:677
@ LAYER_PAD_FR
smd pads, front layer
Definition: layers_id_colors_and_visibility.h:180
bool IsNetnameLayer(LAYER_NUM aLayer)
Function IsNetnameLayer tests whether a layer is a netname layer.
Definition: layers_id_colors_and_visibility.h:798
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
Definition: layers_id_colors_and_visibility.h:706
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount=0)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
@ LAYER_CURSOR
PCB cursor.
Definition: layers_id_colors_and_visibility.h:199
GERBVIEW_LAYER_ID
GerbView draw layers.
Definition: layers_id_colors_and_visibility.h:283
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layers_id_colors_and_visibility.h:168
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
Definition: layers_id_colors_and_visibility.h:46
@ LAYER_NO_CONNECTS
show a marker on pads with no nets
Definition: layers_id_colors_and_visibility.h:185
LSET()
Constructor LSET() creates an empty (cleared) set.
Definition: layers_id_colors_and_visibility.h:398
@ LAYER_VIA_BBLIND
to draw blind/buried vias
Definition: layers_id_colors_and_visibility.h:173
static LSET BackTechMask()
Function BackTechMask returns a mask holding all technical layers (no CU layer) on back side.
std::string FmtHex() const
Function FmtHex returns a hex string showing contents of this LSEQ.
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layers_id_colors_and_visibility.h:775
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount=0)
Function FlippedLayerNumber.
static LSET ExternalCuMask()
Function ExternalCuMask returns a mask holding the Front and Bottom layers.
@ LAYER_DRC
drc markers
Definition: layers_id_colors_and_visibility.h:194
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layers_id_colors_and_visibility.h:231
static LSET ForbiddenTextLayers()
Function ForbiddenTextLayers Layers which are now allowed to have text on them.
@ GAL_LAYER_ID_BITMASK_END
This is the end of the layers used for visibility bitmasks in Pcbnew There can be at most 32 layers a...
Definition: layers_id_colors_and_visibility.h:205
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
static LSET FrontTechMask()
Function FrontTechMask returns a mask holding all technical layers (no CU layer) on front side.
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
@ LAYER_MOD_REFERENCES
show modules references (when texts are visibles)
Definition: layers_id_colors_and_visibility.h:189
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc)
Definition: layers_id_colors_and_visibility.h:200
@ LAYER_PAD_FR_NETNAMES
Additional netnames layers (not associated with a PCB layer)
Definition: layers_id_colors_and_visibility.h:154
static LSET AllBoardTechMask()
Function AllTechMask returns a mask holding board technical layers (no CU layer) on both side.
@ GERBVIEW_LAYER_ID_RESERVED
GerbView draw layers and d-code layers.
Definition: layers_id_colors_and_visibility.h:287
@ LAYER_VIA_MICROVIA
to draw micro vias
Definition: layers_id_colors_and_visibility.h:172
@ LAYER_PAD_BK
smd pads, back layer
Definition: layers_id_colors_and_visibility.h:181
@ LAYER_ANCHOR
anchor of items having an anchor point (texts, footprints)
Definition: layers_id_colors_and_visibility.h:179
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layers_id_colors_and_visibility.h:198
#define NETNAMES_LAYER_INDEX(layer)
Macro for obtaining netname layer for a given PCB layer.
Definition: layers_id_colors_and_visibility.h:163
int ParseHex(const char *aStart, int aCount)
Function ParseHex understands the output of FmtHex() and replaces this set's values with those given ...
bool IsPcbLayer(LAYER_NUM aLayer)
Function IsPcbLayer tests whether a layer is a valid layer for pcbnew.
Definition: layers_id_colors_and_visibility.h:655
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layers_id_colors_and_visibility.h:72
@ LAYER_MOD_TEXT_INVISIBLE
text marked as invisible
Definition: layers_id_colors_and_visibility.h:178
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
NETNAMES_LAYER_ID
Dedicated layers for net names used in Pcbnew.
Definition: layers_id_colors_and_visibility.h:144
LSEQ CuStack() const
Function CuStack returns a sequence of copper layers in starting from the front/top and extending to ...
@ LAYER_MOD_BK
show modules on back
Definition: layers_id_colors_and_visibility.h:187
LSET(unsigned aIdCount, int aFirst,...)
Constructor LSET( unsigned, PCB_LAYER_ID, ...) takes one or more PCB_LAYER_IDs in the argument list t...
LSEQ SeqStackupBottom2Top() const
Function SeqStackBottom2Top returns the sequence that is typical for a bottom-to-top stack-up.
@ LAYER_PADS_TH
multilayer pads, usually with holes
Definition: layers_id_colors_and_visibility.h:191
@ LAYER_SELECT_OVERLAY
currently selected items overlay
Definition: layers_id_colors_and_visibility.h:197
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
@ LAYER_MOD_FR
show modules on front
Definition: layers_id_colors_and_visibility.h:186
bool IsValidLayer(LAYER_NUM aLayerId)
Function IsValidLayer tests whether a given integer is a valid layer index, i.e.
Definition: layers_id_colors_and_visibility.h:644
@ LAYER_WORKSHEET
worksheet frame
Definition: layers_id_colors_and_visibility.h:195
static LSET FrontBoardTechMask()
Function FrontBoardTechMask returns a mask holding technical layers used in a board fabrication (no C...
LSEQ Users() const
*_User layers.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Function Seq returns an LSEQ from the union of this LSET and a desired sequence.
@ LAYER_VIA_THROUGH
to draw usual through hole vias
Definition: layers_id_colors_and_visibility.h:174
@ LAYER_PADS_PLATEDHOLES
to draw pad holes (plated)
Definition: layers_id_colors_and_visibility.h:192
@ LAYER_GP_OVERLAY
general purpose overlay
Definition: layers_id_colors_and_visibility.h:196
LSEQ Seq() const
Function Seq returns a LSEQ from this LSET in ascending PCB_LAYER_ID order.
LSET(PCB_LAYER_ID aLayer)
Constructor LSET( PCB_LAYER_ID ) takes a PCB_LAYER_ID and sets that bit.
Definition: layers_id_colors_and_visibility.h:423
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layers_id_colors_and_visibility.h:729
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
LSEQ TechAndUserUIOrder() const
Returns the technical and user layers in the order shown in layer widget.
static LSET BackBoardTechMask()
Function BackBoardTechMask returns a mask holding technical layers used in a board fabrication (no CU...
@ GAL_LAYER_ID_END
Add new GAL layers here.
Definition: layers_id_colors_and_visibility.h:209
Class LSET is a set of PCB_LAYER_IDs.
Definition: layers_id_colors_and_visibility.h:381
static LSET BackMask()
Function BackMask returns a mask holding all technical layers and the external CU layer on back side.
@ LAYER_VIAS_HOLES
to draw via holes (pad holes do not use this layer)
Definition: layers_id_colors_and_visibility.h:193
bool IsUserLayer(PCB_LAYER_ID aLayerId)
Function IsUserLayer tests whether a layer is a non copper and a non tech layer.
Definition: layers_id_colors_and_visibility.h:688
@ NETNAMES_LAYER_ID_RESERVED
Reserved space for board layer netnames.
Definition: layers_id_colors_and_visibility.h:150
@ LAYER_MOD_VALUES
show modules values (when texts are visibles)
Definition: layers_id_colors_and_visibility.h:188
LSET(const PCB_LAYER_ID *aArray, unsigned aCount)
Constructor LSET( const PCB_LAYER_ID* aArray, unsigned aCount ) works well with an array or LSEQ.
GAL_LAYER_ID operator+(const GAL_LAYER_ID &a, int b)
Used for via types.
Definition: layers_id_colors_and_visibility.h:222
static LSET ForbiddenFootprintLayers()
Function ForbiddenFootprintLayers Layers which are not allowed within footprint definitions.
LSEQ Technicals(LSET aSubToOmit=LSET()) const
Function Technicals returns a sequence of technical layers.
@ LAYER_DRAW_BITMAPS
to handle and draw images bitmaps
Definition: layers_id_colors_and_visibility.h:201