68 UNSELECTED_LAYER = -2,
70 PCBNEW_LAYER_ID_START = 0,
71 F_Cu = PCBNEW_LAYER_ID_START,
147#define MAX_CU_LAYERS (B_Cu - F_Cu + 1)
150enum NETNAMES_LAYER_ID:
int
153 NETNAMES_LAYER_ID_START = PCB_LAYER_ID_COUNT,
157 NETNAMES_LAYER_ID_RESERVED = NETNAMES_LAYER_ID_START + PCB_LAYER_ID_COUNT,
161 LAYER_PAD_FR_NETNAMES,
162 LAYER_PAD_BK_NETNAMES,
166 NETNAMES_LAYER_ID_END
170#define NETNAMES_LAYER_INDEX( layer ) ( NETNAMES_LAYER_ID_START + layer )
185enum GAL_LAYER_ID:
int
187 GAL_LAYER_ID_START = NETNAMES_LAYER_ID_END,
189 LAYER_VIAS = GAL_LAYER_ID_START + 0,
190 LAYER_VIA_MICROVIA = GAL_LAYER_ID_START + 1,
191 LAYER_VIA_BBLIND = GAL_LAYER_ID_START + 2,
192 LAYER_VIA_THROUGH = GAL_LAYER_ID_START + 3,
193 LAYER_NON_PLATEDHOLES = GAL_LAYER_ID_START + 4,
194 LAYER_MOD_TEXT = GAL_LAYER_ID_START + 5,
196 LAYER_MOD_TEXT_INVISIBLE = GAL_LAYER_ID_START + 7,
197 LAYER_ANCHOR = GAL_LAYER_ID_START + 8,
198 LAYER_PAD_FR = GAL_LAYER_ID_START + 9,
199 LAYER_PAD_BK = GAL_LAYER_ID_START + 10,
200 LAYER_RATSNEST = GAL_LAYER_ID_START + 11,
201 LAYER_GRID = GAL_LAYER_ID_START + 12,
202 LAYER_GRID_AXES = GAL_LAYER_ID_START + 13,
203 LAYER_NO_CONNECTS = GAL_LAYER_ID_START + 14,
204 LAYER_MOD_FR = GAL_LAYER_ID_START + 15,
205 LAYER_MOD_BK = GAL_LAYER_ID_START + 16,
206 LAYER_MOD_VALUES = GAL_LAYER_ID_START + 17,
207 LAYER_MOD_REFERENCES = GAL_LAYER_ID_START + 18,
208 LAYER_TRACKS = GAL_LAYER_ID_START + 19,
209 LAYER_PADS_TH = GAL_LAYER_ID_START + 20,
210 LAYER_PAD_PLATEDHOLES = GAL_LAYER_ID_START + 21,
211 LAYER_VIA_HOLES = GAL_LAYER_ID_START + 22,
212 LAYER_DRC_ERROR = GAL_LAYER_ID_START + 23,
213 LAYER_DRAWINGSHEET = GAL_LAYER_ID_START + 24,
214 LAYER_GP_OVERLAY = GAL_LAYER_ID_START + 25,
215 LAYER_SELECT_OVERLAY = GAL_LAYER_ID_START + 26,
216 LAYER_PCB_BACKGROUND = GAL_LAYER_ID_START + 27,
217 LAYER_CURSOR = GAL_LAYER_ID_START + 28,
218 LAYER_AUX_ITEMS = GAL_LAYER_ID_START + 29,
219 LAYER_DRAW_BITMAPS = GAL_LAYER_ID_START + 30,
222 GAL_LAYER_ID_BITMASK_END = GAL_LAYER_ID_START + 31,
226 LAYER_PADS = GAL_LAYER_ID_START + 32,
227 LAYER_ZONES = GAL_LAYER_ID_START + 33,
229 LAYER_PAD_HOLEWALLS = GAL_LAYER_ID_START + 34,
230 LAYER_VIA_HOLEWALLS = GAL_LAYER_ID_START + 35,
231 LAYER_DRC_WARNING = GAL_LAYER_ID_START + 36,
232 LAYER_DRC_EXCLUSION = GAL_LAYER_ID_START + 37,
233 LAYER_MARKER_SHADOWS = GAL_LAYER_ID_START + 38,
238 LAYER_DRAWINGSHEET_PAGE1,
239 LAYER_DRAWINGSHEET_PAGEn,
243 LAYER_ZONE_END = LAYER_ZONE_START + PCB_LAYER_ID_COUNT,
249#define GAL_LAYER_INDEX( x ) ( x - GAL_LAYER_ID_START )
252#define ZONE_LAYER_FOR( copperLayer ) ( LAYER_ZONE_START + copperLayer )
254constexpr int GAL_LAYER_ID_COUNT = GAL_LAYER_ID_END - GAL_LAYER_ID_START;
256inline GAL_LAYER_ID operator++( GAL_LAYER_ID& a )
258 a = GAL_LAYER_ID(
int( a ) + 1 );
262inline GAL_LAYER_ID ToGalLayer(
int aInteger )
264 wxASSERT( aInteger >= GAL_LAYER_ID_START && aInteger <= GAL_LAYER_ID_END );
265 return static_cast<GAL_LAYER_ID
>( aInteger );
269inline GAL_LAYER_ID operator+(
const GAL_LAYER_ID& a,
int b )
271 GAL_LAYER_ID t = GAL_LAYER_ID(
int( a ) + b );
272 wxASSERT( t <= GAL_LAYER_ID_END );
276typedef std::bitset<GAL_LAYER_ID_COUNT> GAL_BASE_SET;
282 static constexpr int start =
static_cast<int>( GAL_LAYER_ID_START );
285 GAL_SET() : std::bitset<GAL_LAYER_ID_COUNT>()
289 GAL_SET(
const GAL_SET& aOther ) : std::bitset<GAL_LAYER_ID_COUNT>( aOther )
293 GAL_SET(
const GAL_LAYER_ID* aArray,
unsigned aCount );
301 GAL_SET& set(
int aPos,
bool aVal =
true )
303 GAL_BASE_SET::set( aPos, aVal );
307 GAL_SET& set( GAL_LAYER_ID aPos,
bool aVal =
true )
309 GAL_BASE_SET::set(
static_cast<std::size_t
>( aPos ) - start, aVal );
313 bool Contains( GAL_LAYER_ID aPos )
315 return test(
static_cast<std::size_t
>( aPos ) - start );
318 std::vector<GAL_LAYER_ID> Seq()
const;
320 static GAL_SET DefaultVisible();
324enum SCH_LAYER_ID:
int
326 SCH_LAYER_ID_START = GAL_LAYER_ID_END,
328 LAYER_WIRE = SCH_LAYER_ID_START,
351 LAYER_DEVICE_BACKGROUND,
352 LAYER_SHEET_BACKGROUND,
353 LAYER_SCHEMATIC_GRID,
354 LAYER_SCHEMATIC_GRID_AXES,
355 LAYER_SCHEMATIC_BACKGROUND,
356 LAYER_SCHEMATIC_CURSOR,
359 LAYER_SELECTION_SHADOWS,
360 LAYER_SCHEMATIC_DRAWINGSHEET,
362 LAYER_SCHEMATIC_AUX_ITEMS,
363 LAYER_SCHEMATIC_ANCHOR,
368#define SCH_LAYER_ID_COUNT ( SCH_LAYER_ID_END - SCH_LAYER_ID_START )
370#define SCH_LAYER_INDEX( x ) ( x - SCH_LAYER_ID_START )
372inline SCH_LAYER_ID operator++( SCH_LAYER_ID& a )
374 a = SCH_LAYER_ID(
int( a ) + 1 );
379#define GERBER_DRAWLAYERS_COUNT PCB_LAYER_ID_COUNT
382enum GERBVIEW_LAYER_ID:
int
384 GERBVIEW_LAYER_ID_START = SCH_LAYER_ID_END,
387 GERBVIEW_LAYER_ID_RESERVED = GERBVIEW_LAYER_ID_START + ( 2 * GERBER_DRAWLAYERS_COUNT ),
390 LAYER_NEGATIVE_OBJECTS,
393 LAYER_GERBVIEW_BACKGROUND,
394 LAYER_GERBVIEW_DRAWINGSHEET,
396 GERBVIEW_LAYER_ID_END
399#define GERBER_DRAW_LAYER( x ) ( GERBVIEW_LAYER_ID_START + x )
401#define GERBER_DCODE_LAYER( x ) ( GERBER_DRAWLAYERS_COUNT + x )
403#define GERBER_DRAW_LAYER_INDEX( x ) ( x - GERBVIEW_LAYER_ID_START )
407enum LAYER_3D_ID :
int
409 LAYER_3D_START = GERBVIEW_LAYER_ID_END,
411 LAYER_3D_BACKGROUND_BOTTOM,
412 LAYER_3D_BACKGROUND_TOP,
415 LAYER_3D_SILKSCREEN_BOTTOM,
416 LAYER_3D_SILKSCREEN_TOP,
417 LAYER_3D_SOLDERMASK_BOTTOM,
418 LAYER_3D_SOLDERMASK_TOP,
419 LAYER_3D_SOLDERPASTE,
421 LAYER_3D_END = LAYER_3D_SOLDERPASTE
425#define LAYER_ID_COUNT LAYER_3D_END
439#define MIN_VISIBILITY_MASK int( ( 1 << GAL_LAYER_INDEX( LAYER_PAD_PLATEDHOLES ) ) +\
440 ( 1 << GAL_LAYER_INDEX( LAYER_VIA_HOLES ) ) +\
441 ( 1 << GAL_LAYER_INDEX( LAYER_SELECT_OVERLAY ) ) +\
442 ( 1 << GAL_LAYER_INDEX( LAYER_GP_OVERLAY ) ) +\
443 ( 1 << GAL_LAYER_INDEX( LAYER_RATSNEST ) ) )
447typedef std::vector<PCB_LAYER_ID> BASE_SEQ;
476 template <
class InputIterator>
477 LSEQ( InputIterator aStart, InputIterator aEnd ) :
478 BASE_SEQ( aStart, aEnd ), m_index( 0 )
481 void Rewind() { m_index = 0; }
483 void operator ++ () { ++m_index; }
485 void operator ++ (
int) { ++m_index; }
487 operator bool () {
return m_index < size(); }
489 PCB_LAYER_ID operator * ()
const
491 return at( m_index );
496typedef std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;
527 LSET(
const BASE_SET& aOther ) :
555 LSET(
const PCB_LAYER_ID* aArray,
unsigned aCount );
568 LSET(
unsigned aIdCount,
int aFirst, ... );
580 return test( aLayer );
582 catch( std::out_of_range& )
591 static const wxChar*
Name( PCB_LAYER_ID aLayerId );
624 static LSET AllLayersMask();
668 static LSET UserMask();
708 LSEQ UIOrder()
const;
717 LSEQ Seq(
const PCB_LAYER_ID* aWishListSequence,
unsigned aCount )
const;
761 LSET(
unsigned long __val )
775inline bool IsValidLayer( LAYER_NUM aLayerId )
777 return unsigned( aLayerId ) < PCB_LAYER_ID_COUNT;
786inline bool IsPcbLayer( LAYER_NUM aLayer )
788 return aLayer >= F_Cu && aLayer < PCB_LAYER_ID_COUNT;
797inline bool IsCopperLayer( LAYER_NUM aLayerId )
799 return aLayerId >= F_Cu && aLayerId <= B_Cu;
808inline bool IsNonCopperLayer( LAYER_NUM aLayerId )
810 return aLayerId > B_Cu && aLayerId <= PCB_LAYER_ID_COUNT;
821inline bool IsCopperLayer( LAYER_NUM aLayerId,
bool aIncludeSyntheticCopperLayers )
823 if( aIncludeSyntheticCopperLayers )
824 return !IsNonCopperLayer( aLayerId );
826 return IsCopperLayer( aLayerId );
829inline bool IsViaPadLayer( LAYER_NUM aLayer )
831 return aLayer == LAYER_VIA_THROUGH
832 || aLayer == LAYER_VIA_MICROVIA
833 || aLayer == LAYER_VIA_BBLIND;
836inline bool IsHoleLayer( LAYER_NUM aLayer )
838 return aLayer == LAYER_VIA_HOLES
839 || aLayer == LAYER_VIA_HOLEWALLS
840 || aLayer == LAYER_PAD_PLATEDHOLES
841 || aLayer == LAYER_PAD_HOLEWALLS
842 || aLayer == LAYER_NON_PLATEDHOLES;
851inline bool IsUserLayer( PCB_LAYER_ID aLayerId )
853 return aLayerId >= Dwgs_User && aLayerId <= Eco2_User;
873inline bool IsFrontLayer( PCB_LAYER_ID aLayerId )
896inline bool IsBackLayer( PCB_LAYER_ID aLayerId )
925PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayerId,
int aCopperLayersCount = 0 );
936LSET FlipLayerMask(
LSET aMask,
int aCopperLayersCount = 0 );
942inline int GetNetnameLayer(
int aLayer )
944 if( IsCopperLayer( aLayer ) )
945 return NETNAMES_LAYER_INDEX( aLayer );
946 else if( aLayer == LAYER_PADS_TH )
947 return LAYER_PAD_NETNAMES;
948 else if( aLayer == LAYER_PAD_FR )
949 return LAYER_PAD_FR_NETNAMES;
950 else if( aLayer == LAYER_PAD_BK )
951 return LAYER_PAD_BK_NETNAMES;
952 else if( IsViaPadLayer( aLayer ) )
953 return LAYER_VIA_NETNAMES;
965inline bool IsNetnameLayer( LAYER_NUM aLayer )
967 return aLayer >= NETNAMES_LAYER_INDEX( F_Cu ) &&
968 aLayer < NETNAMES_LAYER_ID_END;
972inline bool IsZoneLayer( LAYER_NUM aLayer )
974 return aLayer >= LAYER_ZONE_START && aLayer <= LAYER_ZONE_END;
978inline bool IsDCodeLayer(
int aLayer )
980 return aLayer >= (GERBVIEW_LAYER_ID_START + GERBER_DRAWLAYERS_COUNT) &&
981 aLayer < (GERBVIEW_LAYER_ID_START + (2 * GERBER_DRAWLAYERS_COUNT));
991inline bool IsNetCopperLayer( LAYER_NUM aLayer )
993 static std::set<LAYER_NUM> netCopperLayers =
1005 return IsCopperLayer( aLayer ) || netCopperLayers.count( aLayer );
1009PCB_LAYER_ID ToLAYER_ID(
int aLayer );
Helper for storing and iterating over GAL_LAYER_IDs.
Definition layer_ids.h:280
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition layer_ids.h:467
LSET is a set of PCB_LAYER_IDs.
Definition layer_ids.h:506
static LSET BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
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 FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
static LSET BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
LSET(PCB_LAYER_ID aLayer)
Take a PCB_LAYER_ID and sets that bit.
Definition layer_ids.h:546
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
Definition layer_ids.h:576
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 SeqStackupBottom2Top() const
Return the sequence that is typical for a bottom-to-top stack-up.
LSEQ TechAndUserUIOrder() const
Returns the technical and user layers in the order shown in layer widget.
LSET(unsigned aIdCount, int aFirst,...)
Take one or more PCB_LAYER_IDs in the argument list to construct the set.
static LSET FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
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 UserDefinedLayers()
Return a mask with all of the allowable user defined layers.
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
LSEQ Technicals(LSET aSubToOmit=LSET()) const
Return a sequence of technical layers.
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
static LSET FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
std::string FmtBin() const
Return a binary string showing contents of this LSEQ.
LSET(const PCB_LAYER_ID *aArray, unsigned aCount)
Create an array or LSEQ.
LSEQ Users() const
*_User layers.
static LSET FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
LSET()
Create an empty (cleared) set.
Definition layer_ids.h:522
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
static LSET AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
Definition wx_compat.h:13