KiCad PCB EDA Suite
Loading...
Searching...
No Matches
lset.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <algorithm>
26#include <bitset> // for bitset, __bitset<>::ref...
27#include <cassert>
28#include <cstdarg>
29#include <iostream> // for string, endl, basic_ost...
30#include <cstddef> // for size_t
31#include <map>
32
33#include <core/arraydim.h>
34#include <layer_ids.h> // for PCB_LAYER_ID
35#include <layer_range.h>
36#include <lseq.h>
37#include <macros.h> // for arrayDim
38#include <wx/debug.h> // for wxASSERT, wxASSERT_MSG
39#include <wx/string.h>
40
41#include <lset.h>
42
43
44LSET::LSET( std::initializer_list<PCB_LAYER_ID> aList ) :
45 LSET()
46{
47 for( PCB_LAYER_ID layer : aList )
48 {
49 if( layer >= 0 )
50 set( layer );
51 }
52}
53
54LSET::LSET( const std::vector<PCB_LAYER_ID>& aList ) :
55 LSET()
56{
57 for( PCB_LAYER_ID layer : aList )
58 {
59 if( layer >= 0 )
60 set( layer );
61 }
62}
63
64
65LSET::LSET( const LSEQ& aSeq ) :
66 LSET()
67{
68 for( PCB_LAYER_ID layer : aSeq )
69 {
70 if( layer >= 0 )
71 set( layer );
72 }
73}
74
75
76LSET::LSET( const LAYER_RANGE& aRange )
77{
78 for( PCB_LAYER_ID layer : aRange )
79 {
80 if( layer >= 0 )
81 set( layer );
82 }
83}
84
85
86int LSET::LayerCount( PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd, int aCopperLayerCount )
87{
88 int start = aStart;
89 int end = aEnd;
90
91 // Both layers need to be copper
92 wxCHECK( IsCopperLayer( aStart ) && IsCopperLayer( aEnd ), aCopperLayerCount );
93
94 if( aStart == B_Cu )
95 std::swap( start, end );
96
97 if( aStart == aEnd )
98 return 1;
99
100 if( aStart == F_Cu )
101 {
102 if ( aEnd == B_Cu )
103 return aCopperLayerCount;
104 else
105 return ( end - start ) / 2 - 1;
106 }
107 else if ( aEnd == B_Cu )
108 {
109 // Add 1 for the B_Cu layer
110 return aCopperLayerCount - start / 2 + 1;
111 }
112
113 return ( end - start ) / 2;
114}
115
116
117int LSET::NameToLayer( wxString& aName )
118{
119 std::map<wxString, PCB_LAYER_ID> layerMap = {
120 { "F.Cu", F_Cu },
121 { "B.Cu", B_Cu },
122 { "F.Adhes", F_Adhes },
123 { "B.Adhes", B_Adhes },
124 { "F.Paste", F_Paste },
125 { "B.Paste", B_Paste },
126 { "F.SilkS", F_SilkS },
127 { "B.SilkS", B_SilkS },
128 { "F.Mask", F_Mask },
129 { "B.Mask", B_Mask },
130 { "Dwgs.User", Dwgs_User },
131 { "Cmts.User", Cmts_User },
132 { "Eco1.User", Eco1_User },
133 { "Eco2.User", Eco2_User },
134 { "Edge.Cuts", Edge_Cuts },
135 { "Margin", Margin },
136 { "F.CrtYd", F_CrtYd },
137 { "B.CrtYd", B_CrtYd },
138 { "F.Fab", F_Fab },
139 { "B.Fab", B_Fab },
140 { "Rescue", Rescue },
141 { "B.Cu", B_Cu },
142 };
143
144 if( auto it = layerMap.find( aName ); it != layerMap.end() )
145 return static_cast<int>( it->second );
146
147 if( aName.StartsWith( "User." ) )
148 {
149 long offset;
150
151 if( aName.Mid( 5 ).ToLong( &offset ) && offset > 0 )
152 return static_cast<int>( User_1 ) + ( offset - 1 ) * 2;
153 }
154
155 if( aName.StartsWith( "In" ) )
156 {
157 long offset;
158 wxString str_num = aName.Mid( 2 );
159 str_num.RemoveLast( 3 ); // Removes .Cu
160
161 if( str_num.ToLong( &offset ) && offset > 0 )
162 return static_cast<int>( In1_Cu ) + ( offset - 1 ) * 2;
163 }
164
165 return -1;
166}
167
168
170{
171 if( aLayer == aStart || aLayer == aEnd )
172 return true;
173
174 int start = std::min( aStart, aEnd );
175 int end = std::max( aStart, aEnd );
176 int layer = aLayer;
177
178 if( end == B_Cu )
179 {
180 //Reassign the end layer to the largest possible positive even number
181 end = std::numeric_limits<PCB_LAYER_ID>::max() & ~1;
182 }
183
184 return !( layer & 1 ) && ( layer >= start ) && ( layer <= end );
185}
186
187
188wxString LSET::Name( PCB_LAYER_ID aLayerId )
189{
190 wxString txt;
191
192 // using a switch to explicitly show the mapping more clearly
193 switch( aLayerId )
194 {
195 case F_Cu: txt = wxT( "F.Cu" ); break;
196 case B_Cu: txt = wxT( "B.Cu" ); break;
197
198 // Technicals
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;
207
208 // Users
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;
215
216 // Footprint
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;
221
222 // Rescue
223 case Rescue: txt = wxT( "Rescue" ); break;
224
225 default:
226
227 if( static_cast<int>( aLayerId ) & 1 )
228 {
229 int offset = ( aLayerId - Rescue ) / 2;
230 txt = wxString::Format( wxT( "User.%d" ), offset );
231 }
232 else
233 {
234 int offset = ( aLayerId - B_Cu ) / 2;
235 txt = wxString::Format( wxT( "In%d.Cu" ), offset );
236 }
237
238
239 }
240
241 return txt;
242}
243
244
246{
247 LSEQ ret;
248
249 ret.reserve( 32 );
250
251 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
252 ret.push_back( *it );
253
254 return ret;
255}
256
257
259{
260 LSEQ ret;
261
262 ret.reserve( 32 );
263
264 ret = Seq( {
265 F_Adhes,
266 B_Adhes,
267 F_Paste,
268 B_Paste,
269 F_SilkS,
270 B_SilkS,
271 F_Mask,
272 B_Mask,
273 Dwgs_User,
274 Cmts_User,
275 Eco1_User,
276 Eco2_User,
277 Edge_Cuts,
278 Margin,
279 F_CrtYd,
280 B_CrtYd,
281 F_Fab,
282 B_Fab
283 } );
284
285 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
286 {
287 if( *it >= User_1 )
288 ret.push_back( *it );
289 }
290
291 return ret;
292}
293
294
295LSEQ LSET::Seq( const LSEQ& aSequence ) const
296{
297 LSEQ ret;
298
299 for( PCB_LAYER_ID layer : aSequence )
300 {
301 if( test( layer ) )
302 ret.push_back( layer );
303 }
304
305 return ret;
306}
307
308
310{
311 LSEQ ret;
312
313 ret.reserve( size() );
314
315 for( unsigned i = 0; i < size(); ++i )
316 {
317 if( test( i ) )
318 ret.push_back( PCB_LAYER_ID( i ) );
319 }
320
321 return ret;
322}
323
324
326{
327 LSEQ base_sequence = Seq( {
328 Edge_Cuts,
329 Margin,
330 Dwgs_User,
331 Cmts_User,
332 Eco1_User,
334 } );
335
336 LSEQ top_tech_sequence = Seq( {
337 F_Fab,
338 F_SilkS,
339 F_Paste,
340 F_Adhes,
341 F_Mask,
342 F_CrtYd,
343 } );
344
345 LSEQ bottom_tech_sequence = Seq( {
346 B_CrtYd,
347 B_Mask,
348 B_Adhes,
349 B_Paste,
350 B_SilkS,
351 B_Fab,
352 } );
353
354
355 LSEQ seq = Seq( base_sequence );
356
357 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
358 {
359 if( *it >= User_1 )
360 seq.push_back( *it );
361 }
362
363 std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
364
365 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
366 seq.push_back( *it );
367
368 std::copy( bottom_tech_sequence.begin(), bottom_tech_sequence.end(),
369 std::back_inserter( seq ) );
370
371 if( aSelectedLayer != UNDEFINED_LAYER )
372 {
373 auto it = std::find( seq.begin(), seq.end(), aSelectedLayer );
374
375 if( it != seq.end() )
376 {
377 seq.erase( it );
378 seq.insert( seq.begin(), aSelectedLayer );
379 }
380 }
381
382 return seq;
383}
384
385
387{
388 // bottom-to-top stack-up layers
389 // Note that the bottom technical layers are flipped so that when plotting a bottom-side view,
390 // they appear in the correct sequence.
391 LSEQ bottom_tech_sequence = Seq( {
392 B_Cu,
393 B_Mask,
394 B_Paste,
395 B_SilkS,
396 B_Adhes,
397 B_CrtYd,
398 B_Fab,
399 } );
400
401 // Copper layers go here
402
403 LSEQ top_tech_sequence = Seq( {
404 F_Mask,
405 F_Paste,
406 F_SilkS,
407 F_Adhes,
408 F_CrtYd,
409 F_Fab,
410 } );
411
412 LSEQ user_sequence = Seq( {
413 Dwgs_User,
414 Cmts_User,
415 Eco1_User,
416 Eco2_User,
417 } );
418
419 // User layers go here
420
421 LSEQ base_sequence = Seq( {
422 Margin,
423 Edge_Cuts,
424 } );
425
426
427
428 LSEQ seq = Seq( bottom_tech_sequence );
429
430 std::vector<PCB_LAYER_ID> temp_layers;
431
432 // We are going to reverse the copper layers and then add them to the sequence
433 // because the plotting order is bottom-to-top
434 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
435 {
436 // Skip B_Cu because it is already in the sequence (if it exists)
437 if( *it != B_Cu )
438 temp_layers.push_back( *it );
439 }
440
441 for( auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
442 seq.push_back( *it );
443
444 std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
445
446 std::copy( user_sequence.begin(), user_sequence.end(), std::back_inserter( seq ) );
447
448 temp_layers.clear();
449
450 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
451 {
452 if( *it >= User_1 )
453 temp_layers.push_back( *it );
454 }
455
456 for( auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
457 {
458 seq.push_back( *it );
459 }
460
461 std::copy( base_sequence.begin(), base_sequence.end(), std::back_inserter( seq ) );
462
463 return seq;
464}
465
466
467LSET& LSET::Flip( int aCopperLayersCount )
468{
469 LSET oldMask = *this;
470
471 reset();
472
473 // Mapping for Copper and Non-Copper layers
474 const std::map<PCB_LAYER_ID, PCB_LAYER_ID> flip_map =
475 {
476 {F_Cu, B_Cu},
477 {B_Cu, F_Cu},
478 {F_SilkS, B_SilkS},
479 {B_SilkS, F_SilkS},
480 {F_Adhes, B_Adhes},
481 {B_Adhes, F_Adhes},
482 {F_Mask, B_Mask},
483 {B_Mask, F_Mask},
484 {F_Paste, B_Paste},
485 {B_Paste, F_Paste},
486 {F_CrtYd, B_CrtYd},
487 {B_CrtYd, F_CrtYd},
488 {F_Fab, B_Fab},
489 {B_Fab, F_Fab}
490 };
491
492 for( const auto& pair : flip_map )
493 {
494 if( oldMask.test( pair.first ) )
495 set( pair.second );
496 }
497
498 if( aCopperLayersCount >= 4 )
499 {
500 LSET internalMask = oldMask & InternalCuMask();
501 int innerLayerCount = aCopperLayersCount - 2;
502
503 for( int ii = 1; ii <= innerLayerCount; ii++ )
504 {
505 if( internalMask.test( ( innerLayerCount - ii + 1 ) * 2 + B_Cu ) )
506 {
507 set( ii * 2 + B_Cu );
508 }
509 }
510 }
511
512 return *this;
513}
514
515
517{
518 unsigned set_count = count();
519
520 if( !set_count )
521 return UNSELECTED_LAYER;
522 else if( set_count > 1 )
523 return UNDEFINED_LAYER;
524
525 for( unsigned i=0; i < size(); ++i )
526 {
527 if( test( i ) )
528 return PCB_LAYER_ID( i );
529 }
530
531 wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
532
533 return UNDEFINED_LAYER;
534}
535
536
538{
539 static const LSET saved( { F_SilkS, F_Mask, F_Fab, F_CrtYd } );
540 return saved;
541}
542
543
545{
546 static const LSET saved( { B_SilkS, B_Mask, B_Fab, B_CrtYd } );
547 return saved;
548}
549
550
552{
553 static const LSET saved( { In1_Cu, In2_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu,
558 return saved;
559}
560
561
562LSET LSET::AllCuMask( int aCuLayerCount )
563{
564 LSET ret;
565
566 for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu, aCuLayerCount ) )
567 ret.set( layer );
568
569 return ret;
570}
571
572
574{
575 static const LSET saved = LSET().set() & ~AllCuMask();
576 return saved;
577}
578
579
581{
582 static const LSET saved( { F_Cu, B_Cu } );
583 return saved;
584}
585
586
588{
589 static const LSET saved = LSET().set();
590 return saved;
591}
592
593
595{
596 static const LSET saved( { B_SilkS, B_Mask, B_Adhes, B_Paste, B_CrtYd, B_Fab } );
597 return saved;
598}
599
600
602{
603 static const LSET saved( { B_SilkS, B_Mask, B_Adhes, B_Paste } );
604 return saved;
605}
606
607
609{
610 static const LSET saved( { F_SilkS, F_Mask, F_Adhes, F_Paste, F_CrtYd, F_Fab } );
611 return saved;
612}
613
614
616{
617 static const LSET saved( { F_SilkS, F_Mask, F_Adhes, F_Paste } );
618 return saved;
619}
620
621
623{
624 static const LSET saved = BackTechMask() | FrontTechMask();
625 return saved;
626}
627
628
630{
631 static const LSET saved = BackBoardTechMask() | FrontBoardTechMask();
632 return saved;
633}
634
635
637{
638 static const LSET saved( { Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts, Margin } );
639
640 return saved;
641}
642
643
645{
646 static const LSET saved = AllBoardTechMask() | AllCuMask();
647 return saved;
648}
649
650
652{
653 static const LSET saved(
655
656 return saved;
657}
658
659
661{
662 static const LSET saved = FrontTechMask().set( F_Cu );
663 return saved;
664}
665
666
668{
669 static const LSET saved = BackTechMask().set( B_Cu );
670 return saved;
671}
672
673
675{
676 static const LSET saved = BackTechMask() | FrontTechMask() | AllCuMask();
677 return saved;
678}
679
680
682{
683 static const LSET saved = InternalCuMask();
684 return saved;
685}
686
687
689{
690 LSEQ order = CuStack();
691 LSEQ techuser = TechAndUserUIOrder();
692
693 order.insert( order.end(), techuser.begin(), techuser.end() );
694
695 return order;
696}
697
698
700{
701 // We use std::numeric_limits<int>::max() to represent B_Cu for the connectivity_rtree
702 if( aLayer == std::numeric_limits<int>::max() )
703 return B_Cu;
704
705 wxASSERT( aLayer < GAL_LAYER_ID_END );
706 return PCB_LAYER_ID( aLayer );
707}
708
709
710GAL_SET::GAL_SET( const GAL_LAYER_ID* aArray, unsigned aCount ) : GAL_SET()
711{
712 for( unsigned i = 0; i < aCount; ++i )
713 set( aArray[i] );
714}
715
716
717std::vector<GAL_LAYER_ID> GAL_SET::Seq() const
718{
719 std::vector<GAL_LAYER_ID> ret;
720
721 for( size_t i = 0; i < size(); ++i )
722 {
723 if( test( i ) )
724 ret.push_back( static_cast<GAL_LAYER_ID>( i + GAL_LAYER_ID_START ) );
725 }
726
727 return ret;
728}
729
730
732{
733 static const GAL_LAYER_ID visible[] = {
738 // LAYER_HIDDEN_TEXT, // DEPCREATED SINCE 9.0. Invisible text hidden by default
758 // LAYER_DRC_EXCLUSION, // DRC exclusions hidden by default
771 };
772
773 static const GAL_SET saved( visible, arrayDim( visible ) );
774 return saved;
775}
776
777
778#ifndef SWIG // Skip SWIG generators for the iterators because it requires a default constructor
779// Custom iterators for Copper and Non-Copper layers
780
782 BASE_SET::set_bits_iterator( set, index )
783{
784 m_index = ( index + 1 ) & ~1;
786}
787
788
790{
791 return static_cast<PCB_LAYER_ID>( m_index );
792}
793
794
796{
797 next_copper_layer();
798 advance_to_next_set_copper_bit();
799 return *this;
800}
801
802
804{
805 if( m_index == F_Cu )
806 {
807 m_index += 4;
808 }
809 else if( m_index == B_Cu )
810 {
811 m_index = m_baseSet.size();
812 return;
813 }
814 else
815 {
816 m_index += 2;
817
818 if( m_index >= m_baseSet.size() )
819 m_index = B_Cu;
820 }
821}
822
823
825{
826 while( m_index < m_baseSet.size() && !m_baseSet.test( m_index ) )
827 next_copper_layer();
828}
829
830
833{
835}
836
837
839{
840 return static_cast<PCB_LAYER_ID>( m_index );
841}
842
843
845{
846 ++m_index;
847 advance_to_next_set_non_copper_bit();
848 return *this;
849}
850
851
853{
854 while( m_index < m_baseSet.size() && ( m_index % 2 != 1 || !m_baseSet.test( m_index ) ) )
855 {
856 ++m_index;
857 }
858}
859
860
862{
863 return copper_layers_iterator( *this, 0 );
864}
865
866
868{
869 return copper_layers_iterator( *this, size() );
870}
871
872
874{
875 return non_copper_layers_iterator( *this, 0 );
876}
877
878
880{
881 return non_copper_layers_iterator( *this, size() );
882}
883
884
885#endif
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
BASE_SET & set()
Definition: base_set.h:136
BASE_SET & reset()
Definition: base_set.h:153
BASE_SET & set(size_t pos)
Definition: base_set.h:116
Helper for storing and iterating over GAL_LAYER_IDs.
Definition: layer_ids.h:355
GAL_SET()
Definition: layer_ids.h:361
GAL_SET & set()
Definition: layer_ids.h:371
static GAL_SET DefaultVisible()
Definition: lset.cpp:731
std::vector< GAL_LAYER_ID > Seq() const
Definition: lset.cpp:717
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: lseq.h:47
copper_layers_iterator & operator++()
Definition: lset.cpp:795
PCB_LAYER_ID operator*() const
Definition: lset.cpp:789
void advance_to_next_set_copper_bit()
Definition: lset.cpp:824
copper_layers_iterator(const BASE_SET &set, size_t index)
Definition: lset.cpp:781
PCB_LAYER_ID operator*() const
Definition: lset.cpp:838
non_copper_layers_iterator & operator++()
Definition: lset.cpp:844
non_copper_layers_iterator(const BASE_SET &set, size_t index)
Definition: lset.cpp:831
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:37
LSET & Flip(int aCopperLayersCount=0)
Flip the layers in this set.
Definition: lset.cpp:467
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
Definition: lset.cpp:580
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.
Definition: lset.cpp:169
copper_layers_iterator copper_layers_end() const
Definition: lset.cpp:867
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
Definition: lset.cpp:688
static LSET AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
Definition: lset.cpp:629
static LSET AllLayersMask()
Definition: lset.cpp:587
static LSET UserDefinedLayers()
Return a mask with all of the allowable user defined layers.
Definition: lset.cpp:651
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:245
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
Definition: lset.cpp:516
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
Definition: lset.cpp:386
static LSET FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
Definition: lset.cpp:615
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition: lset.cpp:573
static LSET FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
Definition: lset.cpp:537
LSEQ TechAndUserUIOrder() const
Return the technical and user layers in the order shown in layer widget.
Definition: lset.cpp:258
static LSET UserMask()
Definition: lset.cpp:636
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:622
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:551
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:562
static LSET SideSpecificMask()
Definition: lset.cpp:674
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
Definition: lset.cpp:644
all_set_layers_iterator end() const
Definition: lset.h:310
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:309
copper_layers_iterator copper_layers_begin() const
Definition: lset.cpp:861
non_copper_layers_iterator non_copper_layers_begin() const
Definition: lset.cpp:873
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
Definition: lset.cpp:117
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
Definition: lset.cpp:681
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.
Definition: lset.cpp:325
non_copper_layers_iterator non_copper_layers_end() const
Definition: lset.cpp:879
static LSET FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
Definition: lset.cpp:608
static LSET BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
Definition: lset.cpp:601
static LSET BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
Definition: lset.cpp:594
static LSET BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
Definition: lset.cpp:544
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
Definition: lset.cpp:660
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:667
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:188
LSET()
Create an empty (cleared) set.
Definition: lset.h:43
static int LayerCount(PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd, int aCopperLayerCount)
Return the number of layers between aStart and aEnd, inclusive.
Definition: lset.cpp:86
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition: layer_ids.h:581
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:191
@ LAYER_GRID
Definition: layer_ids.h:216
@ GAL_LAYER_ID_START
Definition: layer_ids.h:192
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
Definition: layer_ids.h:269
@ LAYER_VIA_HOLEWALLS
Definition: layer_ids.h:260
@ LAYER_GRID_AXES
Definition: layer_ids.h:217
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
Definition: layer_ids.h:272
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
Definition: layer_ids.h:221
@ LAYER_DRC_SHAPE1
Custom shape for DRC marker.
Definition: layer_ids.h:277
@ LAYER_NON_PLATEDHOLES
Draw usual through hole vias.
Definition: layer_ids.h:201
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition: layer_ids.h:240
@ LAYER_DRAW_BITMAPS
Draw images.
Definition: layer_ids.h:246
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
Definition: layer_ids.h:228
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:243
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
Definition: layer_ids.h:257
@ LAYER_SHAPES
Copper graphic shape opacity/visibility (color ignored).
Definition: layer_ids.h:275
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
Definition: layer_ids.h:254
@ LAYER_DRC_WARNING
Layer for DRC markers with #SEVERITY_WARNING.
Definition: layer_ids.h:263
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
Definition: layer_ids.h:233
@ GAL_LAYER_ID_END
Definition: layer_ids.h:313
@ LAYER_GP_OVERLAY
General purpose overlay.
Definition: layer_ids.h:241
@ LAYER_TRACKS
Definition: layer_ids.h:229
@ LAYER_CURSOR
PCB cursor.
Definition: layer_ids.h:244
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc).
Definition: layer_ids.h:245
@ LAYER_RATSNEST
Definition: layer_ids.h:215
@ LAYER_DRC_SHAPE2
Custom shape for DRC marker.
Definition: layer_ids.h:278
@ LAYER_FP_TEXT
Definition: layer_ids.h:202
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
Definition: layer_ids.h:222
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
Definition: layer_ids.h:210
@ LAYER_VIA_HOLES
Draw via holes (pad holes do not use this layer).
Definition: layer_ids.h:236
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
Definition: layer_ids.h:225
@ LAYER_VIA_MICROVIA
Definition: layer_ids.h:196
@ LAYER_SELECT_OVERLAY
Selected items overlay.
Definition: layer_ids.h:242
@ LAYER_VIA_THROUGH
Draw blind/buried vias.
Definition: layer_ids.h:198
@ LAYER_DRC_ERROR
Layer for DRC markers with #SEVERITY_ERROR.
Definition: layer_ids.h:239
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:195
@ LAYER_VIA_BBLIND
Draw micro vias.
Definition: layer_ids.h:197
@ LAYER_PAD_HOLEWALLS
Definition: layer_ids.h:259
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ In22_Cu
Definition: layer_ids.h:87
@ In11_Cu
Definition: layer_ids.h:76
@ In29_Cu
Definition: layer_ids.h:94
@ In30_Cu
Definition: layer_ids.h:95
@ User_8
Definition: layer_ids.h:131
@ F_CrtYd
Definition: layer_ids.h:116
@ In17_Cu
Definition: layer_ids.h:82
@ B_Adhes
Definition: layer_ids.h:103
@ Edge_Cuts
Definition: layer_ids.h:112
@ Dwgs_User
Definition: layer_ids.h:107
@ F_Paste
Definition: layer_ids.h:104
@ In9_Cu
Definition: layer_ids.h:74
@ Cmts_User
Definition: layer_ids.h:108
@ User_6
Definition: layer_ids.h:129
@ User_7
Definition: layer_ids.h:130
@ In19_Cu
Definition: layer_ids.h:84
@ In7_Cu
Definition: layer_ids.h:72
@ In28_Cu
Definition: layer_ids.h:93
@ In26_Cu
Definition: layer_ids.h:91
@ F_Adhes
Definition: layer_ids.h:102
@ B_Mask
Definition: layer_ids.h:98
@ B_Cu
Definition: layer_ids.h:65
@ User_5
Definition: layer_ids.h:128
@ Eco1_User
Definition: layer_ids.h:109
@ F_Mask
Definition: layer_ids.h:97
@ In21_Cu
Definition: layer_ids.h:86
@ In23_Cu
Definition: layer_ids.h:88
@ B_Paste
Definition: layer_ids.h:105
@ In15_Cu
Definition: layer_ids.h:80
@ In2_Cu
Definition: layer_ids.h:67
@ User_9
Definition: layer_ids.h:132
@ UNSELECTED_LAYER
Definition: layer_ids.h:62
@ F_Fab
Definition: layer_ids.h:119
@ In10_Cu
Definition: layer_ids.h:75
@ Margin
Definition: layer_ids.h:113
@ F_SilkS
Definition: layer_ids.h:100
@ In4_Cu
Definition: layer_ids.h:69
@ B_CrtYd
Definition: layer_ids.h:115
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
@ Eco2_User
Definition: layer_ids.h:110
@ In16_Cu
Definition: layer_ids.h:81
@ In24_Cu
Definition: layer_ids.h:89
@ In1_Cu
Definition: layer_ids.h:66
@ Rescue
Definition: layer_ids.h:121
@ User_3
Definition: layer_ids.h:126
@ User_1
Definition: layer_ids.h:124
@ B_SilkS
Definition: layer_ids.h:101
@ In13_Cu
Definition: layer_ids.h:78
@ User_4
Definition: layer_ids.h:127
@ In8_Cu
Definition: layer_ids.h:73
@ In14_Cu
Definition: layer_ids.h:79
@ User_2
Definition: layer_ids.h:125
@ In12_Cu
Definition: layer_ids.h:77
@ In27_Cu
Definition: layer_ids.h:92
@ In6_Cu
Definition: layer_ids.h:71
@ In5_Cu
Definition: layer_ids.h:70
@ In3_Cu
Definition: layer_ids.h:68
@ In20_Cu
Definition: layer_ids.h:85
@ F_Cu
Definition: layer_ids.h:64
@ In18_Cu
Definition: layer_ids.h:83
@ In25_Cu
Definition: layer_ids.h:90
@ B_Fab
Definition: layer_ids.h:118
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:699
This file contains miscellaneous commonly used macros and functions.