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( aLayerId < 0 )
228 txt = wxT( "UNDEFINED" );
229 else if( static_cast<int>( aLayerId ) & 1 )
230 {
231 int offset = ( aLayerId - Rescue ) / 2;
232 txt = wxString::Format( wxT( "User.%d" ), offset );
233 }
234 else
235 {
236 int offset = ( aLayerId - B_Cu ) / 2;
237 txt = wxString::Format( wxT( "In%d.Cu" ), offset );
238 }
239
240
241 }
242
243 return txt;
244}
245
246
248{
249 LSEQ ret;
250
251 ret.reserve( 32 );
252
253 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
254 ret.push_back( *it );
255
256 return ret;
257}
258
259
261{
262 LSEQ ret;
263
264 ret.reserve( 32 );
265
266 ret = Seq( {
267 F_Adhes,
268 B_Adhes,
269 F_Paste,
270 B_Paste,
271 F_SilkS,
272 B_SilkS,
273 F_Mask,
274 B_Mask,
275 Dwgs_User,
276 Cmts_User,
277 Eco1_User,
278 Eco2_User,
279 Edge_Cuts,
280 Margin,
281 F_CrtYd,
282 B_CrtYd,
283 F_Fab,
284 B_Fab
285 } );
286
287 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
288 {
289 if( *it >= User_1 )
290 ret.push_back( *it );
291 }
292
293 return ret;
294}
295
296
297LSEQ LSET::Seq( const LSEQ& aSequence ) const
298{
299 LSEQ ret;
300
301 for( PCB_LAYER_ID layer : aSequence )
302 {
303 if( test( layer ) )
304 ret.push_back( layer );
305 }
306
307 return ret;
308}
309
310
312{
313 LSEQ ret;
314
315 ret.reserve( size() );
316
317 for( unsigned i = 0; i < size(); ++i )
318 {
319 if( test( i ) )
320 ret.push_back( PCB_LAYER_ID( i ) );
321 }
322
323 return ret;
324}
325
326
328{
329 LSEQ base_sequence = Seq( {
330 Edge_Cuts,
331 Margin,
332 Dwgs_User,
333 Cmts_User,
334 Eco1_User,
336 } );
337
338 LSEQ top_tech_sequence = Seq( {
339 F_Fab,
340 F_SilkS,
341 F_Paste,
342 F_Adhes,
343 F_Mask,
344 F_CrtYd,
345 } );
346
347 LSEQ bottom_tech_sequence = Seq( {
348 B_CrtYd,
349 B_Mask,
350 B_Adhes,
351 B_Paste,
352 B_SilkS,
353 B_Fab,
354 } );
355
356
357 LSEQ seq = Seq( base_sequence );
358
359 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
360 {
361 if( *it >= User_1 )
362 seq.push_back( *it );
363 }
364
365 std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
366
367 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
368 seq.push_back( *it );
369
370 std::copy( bottom_tech_sequence.begin(), bottom_tech_sequence.end(),
371 std::back_inserter( seq ) );
372
373 if( aSelectedLayer != UNDEFINED_LAYER )
374 {
375 auto it = std::find( seq.begin(), seq.end(), aSelectedLayer );
376
377 if( it != seq.end() )
378 {
379 seq.erase( it );
380 seq.insert( seq.begin(), aSelectedLayer );
381 }
382 }
383
384 return seq;
385}
386
387
389{
390 // bottom-to-top stack-up layers
391 // Note that the bottom technical layers are flipped so that when plotting a bottom-side view,
392 // they appear in the correct sequence.
393 LSEQ bottom_tech_sequence = Seq( {
394 B_Cu,
395 B_Mask,
396 B_Paste,
397 B_SilkS,
398 B_Adhes,
399 B_CrtYd,
400 B_Fab,
401 } );
402
403 // Copper layers go here
404
405 LSEQ top_tech_sequence = Seq( {
406 F_Mask,
407 F_Paste,
408 F_SilkS,
409 F_Adhes,
410 F_CrtYd,
411 F_Fab,
412 } );
413
414 LSEQ user_sequence = Seq( {
415 Dwgs_User,
416 Cmts_User,
417 Eco1_User,
418 Eco2_User,
419 } );
420
421 // User layers go here
422
423 LSEQ base_sequence = Seq( {
424 Margin,
425 Edge_Cuts,
426 } );
427
428
429
430 LSEQ seq = Seq( bottom_tech_sequence );
431
432 std::vector<PCB_LAYER_ID> temp_layers;
433
434 // We are going to reverse the copper layers and then add them to the sequence
435 // because the plotting order is bottom-to-top
436 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
437 {
438 // Skip B_Cu because it is already in the sequence (if it exists)
439 if( *it != B_Cu )
440 temp_layers.push_back( *it );
441 }
442
443 for( auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
444 seq.push_back( *it );
445
446 std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
447
448 std::copy( user_sequence.begin(), user_sequence.end(), std::back_inserter( seq ) );
449
450 temp_layers.clear();
451
452 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
453 {
454 if( *it >= User_1 )
455 temp_layers.push_back( *it );
456 }
457
458 for( auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
459 {
460 seq.push_back( *it );
461 }
462
463 std::copy( base_sequence.begin(), base_sequence.end(), std::back_inserter( seq ) );
464
465 return seq;
466}
467
468
469LSET& LSET::Flip( int aCopperLayersCount )
470{
471 LSET oldMask = *this;
472
473 reset();
474
475 // Mapping for Copper and Non-Copper layers
476 const std::map<PCB_LAYER_ID, PCB_LAYER_ID> flip_map =
477 {
478 {F_Cu, B_Cu},
479 {B_Cu, F_Cu},
480 {F_SilkS, B_SilkS},
481 {B_SilkS, F_SilkS},
482 {F_Adhes, B_Adhes},
483 {B_Adhes, F_Adhes},
484 {F_Mask, B_Mask},
485 {B_Mask, F_Mask},
486 {F_Paste, B_Paste},
487 {B_Paste, F_Paste},
488 {F_CrtYd, B_CrtYd},
489 {B_CrtYd, F_CrtYd},
490 {F_Fab, B_Fab},
491 {B_Fab, F_Fab}
492 };
493
494 for( const auto& pair : flip_map )
495 {
496 if( oldMask.test( pair.first ) )
497 set( pair.second );
498 }
499
500 if( aCopperLayersCount >= 4 )
501 {
502 LSET internalMask = oldMask & InternalCuMask();
503 int innerLayerCount = aCopperLayersCount - 2;
504
505 for( int ii = 1; ii <= innerLayerCount; ii++ )
506 {
507 if( internalMask.test( ( innerLayerCount - ii + 1 ) * 2 + B_Cu ) )
508 {
509 set( ii * 2 + B_Cu );
510 }
511 }
512 }
513
514 return *this;
515}
516
517
519{
520 unsigned set_count = count();
521
522 if( !set_count )
523 return UNSELECTED_LAYER;
524 else if( set_count > 1 )
525 return UNDEFINED_LAYER;
526
527 for( unsigned i=0; i < size(); ++i )
528 {
529 if( test( i ) )
530 return PCB_LAYER_ID( i );
531 }
532
533 wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
534
535 return UNDEFINED_LAYER;
536}
537
538
540{
541 static const LSET saved( { F_SilkS, F_Mask, F_Fab, F_CrtYd } );
542 return saved;
543}
544
545
547{
548 static const LSET saved( { B_SilkS, B_Mask, B_Fab, B_CrtYd } );
549 return saved;
550}
551
552
554{
555 static const LSET saved( { In1_Cu, In2_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu,
560 return saved;
561}
562
563
564LSET LSET::AllCuMask( int aCuLayerCount )
565{
566 LSET ret;
567
568 for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu, aCuLayerCount ) )
569 ret.set( layer );
570
571 return ret;
572}
573
574
576{
577 LSET saved = LSET().set();
578
579 for( auto it = saved.copper_layers_begin(); it != saved.copper_layers_end(); ++it )
580 saved.reset( *it );
581
582 return saved;
583}
584
585
587{
588 static const LSET saved( { F_Cu, B_Cu } );
589 return saved;
590}
591
592
594{
595 static const LSET saved = LSET().set();
596 return saved;
597}
598
599
601{
602 static const LSET saved( { B_SilkS, B_Mask, B_Adhes, B_Paste, B_CrtYd, B_Fab } );
603 return saved;
604}
605
606
608{
609 static const LSET saved( { B_SilkS, B_Mask, B_Adhes, B_Paste } );
610 return saved;
611}
612
613
615{
616 static const LSET saved( { F_SilkS, F_Mask, F_Adhes, F_Paste, F_CrtYd, F_Fab } );
617 return saved;
618}
619
620
622{
623 static const LSET saved( { F_SilkS, F_Mask, F_Adhes, F_Paste } );
624 return saved;
625}
626
627
629{
630 static const LSET saved = BackTechMask() | FrontTechMask();
631 return saved;
632}
633
634
636{
637 static const LSET saved = BackBoardTechMask() | FrontBoardTechMask();
638 return saved;
639}
640
641
643{
644 static const LSET saved( { Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts, Margin } );
645
646 return saved;
647}
648
649
651{
652 static const LSET saved = AllBoardTechMask() | AllCuMask();
653 return saved;
654}
655
656
657LSET LSET::UserDefinedLayersMask( int aUserDefinedLayerCount )
658{
659 LSET ret;
660 size_t layer = User_1;
661
662 for( int ulayer = 1; ulayer <= aUserDefinedLayerCount; ulayer++ )
663 {
664 if( layer > ret.size() )
665 break;
666
667 ret.set( layer );
668 layer += 2;
669 }
670
671 return ret;
672}
673
674
676{
677 static const LSET saved = FrontTechMask().set( F_Cu );
678 return saved;
679}
680
681
683{
684 static const LSET saved = BackTechMask().set( B_Cu );
685 return saved;
686}
687
688
690{
691 static const LSET saved = BackTechMask() | FrontTechMask() | AllCuMask();
692 return saved;
693}
694
695
697{
698 static const LSET saved = InternalCuMask();
699 return saved;
700}
701
702
704{
705 LSEQ order = CuStack();
706 LSEQ techuser = TechAndUserUIOrder();
707
708 order.insert( order.end(), techuser.begin(), techuser.end() );
709
710 return order;
711}
712
713
715{
716 // We use std::numeric_limits<int>::max() to represent B_Cu for the connectivity_rtree
717 if( aLayer == std::numeric_limits<int>::max() )
718 return B_Cu;
719
720 wxASSERT( aLayer < GAL_LAYER_ID_END );
721 return PCB_LAYER_ID( aLayer );
722}
723
724
725GAL_SET::GAL_SET( const GAL_LAYER_ID* aArray, unsigned aCount ) : GAL_SET()
726{
727 for( unsigned i = 0; i < aCount; ++i )
728 set( aArray[i] );
729}
730
731
732std::vector<GAL_LAYER_ID> GAL_SET::Seq() const
733{
734 std::vector<GAL_LAYER_ID> ret;
735
736 for( size_t i = 0; i < size(); ++i )
737 {
738 if( test( i ) )
739 ret.push_back( static_cast<GAL_LAYER_ID>( i + GAL_LAYER_ID_START ) );
740 }
741
742 return ret;
743}
744
745
747{
748 static const GAL_LAYER_ID visible[] = {
753 // LAYER_HIDDEN_TEXT, // DEPCREATED SINCE 9.0. Invisible text hidden by default
773 // LAYER_DRC_EXCLUSION, // DRC exclusions hidden by default
786 };
787
788 static const GAL_SET saved( visible, arrayDim( visible ) );
789 return saved;
790}
791
792
793#ifndef SWIG // Skip SWIG generators for the iterators because it requires a default constructor
794// Custom iterators for Copper and Non-Copper layers
795
797 BASE_SET::set_bits_iterator( set, index )
798{
799 m_index = ( index + 1 ) & ~1;
801}
802
803
805{
806 return static_cast<PCB_LAYER_ID>( m_index );
807}
808
809
811{
812 next_copper_layer();
813 advance_to_next_set_copper_bit();
814 return *this;
815}
816
817
819{
820 if( m_index == F_Cu )
821 {
822 m_index += 4;
823 }
824 else if( m_index == B_Cu )
825 {
826 m_index = m_baseSet.size();
827 return;
828 }
829 else
830 {
831 m_index += 2;
832
833 if( m_index >= m_baseSet.size() )
834 m_index = B_Cu;
835 }
836}
837
838
840{
841 while( m_index < m_baseSet.size() && !m_baseSet.test( m_index ) )
842 next_copper_layer();
843}
844
845
848{
850}
851
852
854{
855 return static_cast<PCB_LAYER_ID>( m_index );
856}
857
858
860{
861 ++m_index;
862 advance_to_next_set_non_copper_bit();
863 return *this;
864}
865
866
868{
869 while( m_index < m_baseSet.size() && ( m_index % 2 != 1 || !m_baseSet.test( m_index ) ) )
870 {
871 ++m_index;
872 }
873}
874
875
877{
878 return copper_layers_iterator( *this, 0 );
879}
880
881
883{
884 return copper_layers_iterator( *this, size() );
885}
886
887
889{
890 return non_copper_layers_iterator( *this, 0 );
891}
892
893
895{
896 return non_copper_layers_iterator( *this, size() );
897}
898
899
901{
902 for( size_t ii = 0; ii < size(); ii += 2 )
903 reset( ii );
904
905 return *this;
906}
907
908
910{
911 for( size_t ii = 1; ii < size(); ii += 2 )
912 reset( ii );
913
914 return *this;
915}
916
917
919{
920 for( size_t ii = User_1; ii < size(); ii += 2 )
921 reset( ii );
922
923 return *this;
924}
925
926#endif
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
BASE_SET & reset(size_t pos)
Definition: base_set.h:143
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:392
GAL_SET()
Definition: layer_ids.h:398
GAL_SET & set()
Definition: layer_ids.h:408
static GAL_SET DefaultVisible()
Definition: lset.cpp:746
std::vector< GAL_LAYER_ID > Seq() const
Definition: lset.cpp:732
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: lseq.h:47
copper_layers_iterator & operator++()
Definition: lset.cpp:810
PCB_LAYER_ID operator*() const
Definition: lset.cpp:804
void advance_to_next_set_copper_bit()
Definition: lset.cpp:839
copper_layers_iterator(const BASE_SET &set, size_t index)
Definition: lset.cpp:796
PCB_LAYER_ID operator*() const
Definition: lset.cpp:853
non_copper_layers_iterator & operator++()
Definition: lset.cpp:859
non_copper_layers_iterator(const BASE_SET &set, size_t index)
Definition: lset.cpp:846
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:469
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
Definition: lset.cpp:586
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:882
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
Definition: lset.cpp:703
static LSET AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
Definition: lset.cpp:635
static LSET AllLayersMask()
Definition: lset.cpp:593
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:247
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
Definition: lset.cpp:518
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
Definition: lset.cpp:388
static LSET FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
Definition: lset.cpp:621
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition: lset.cpp:575
static LSET FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
Definition: lset.cpp:539
LSEQ TechAndUserUIOrder() const
Return the technical and user layers in the order shown in layer widget.
Definition: lset.cpp:260
static LSET UserMask()
Definition: lset.cpp:642
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:628
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:553
LSET & ClearUserDefinedLayers()
Clear the user defined layers in this set.
Definition: lset.cpp:918
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:564
static LSET SideSpecificMask()
Definition: lset.cpp:689
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
Definition: lset.cpp:650
LSET & ClearNonCopperLayers()
Clear the non-copper layers in this set.
Definition: lset.cpp:909
all_set_layers_iterator end() const
Definition: lset.h:327
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:311
copper_layers_iterator copper_layers_begin() const
Definition: lset.cpp:876
non_copper_layers_iterator non_copper_layers_begin() const
Definition: lset.cpp:888
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:696
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:327
non_copper_layers_iterator non_copper_layers_end() const
Definition: lset.cpp:894
LSET & ClearCopperLayers()
Clear the copper layers in this set.
Definition: lset.cpp:900
static LSET FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
Definition: lset.cpp:614
static LSET BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
Definition: lset.cpp:607
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition: lset.cpp:657
static LSET BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
Definition: lset.cpp:600
static LSET BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
Definition: lset.cpp:546
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
Definition: lset.cpp:675
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:682
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:618
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:228
@ LAYER_GRID
Definition: layer_ids.h:253
@ GAL_LAYER_ID_START
Definition: layer_ids.h:229
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
Definition: layer_ids.h:306
@ LAYER_VIA_HOLEWALLS
Definition: layer_ids.h:297
@ LAYER_GRID_AXES
Definition: layer_ids.h:254
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
Definition: layer_ids.h:309
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
Definition: layer_ids.h:258
@ LAYER_DRC_SHAPE1
Custom shape for DRC marker.
Definition: layer_ids.h:314
@ LAYER_NON_PLATEDHOLES
Draw usual through hole vias.
Definition: layer_ids.h:238
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition: layer_ids.h:277
@ LAYER_DRAW_BITMAPS
Draw images.
Definition: layer_ids.h:283
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
Definition: layer_ids.h:265
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:280
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
Definition: layer_ids.h:294
@ LAYER_SHAPES
Copper graphic shape opacity/visibility (color ignored).
Definition: layer_ids.h:312
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
Definition: layer_ids.h:291
@ LAYER_DRC_WARNING
Layer for DRC markers with #SEVERITY_WARNING.
Definition: layer_ids.h:300
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
Definition: layer_ids.h:270
@ GAL_LAYER_ID_END
Definition: layer_ids.h:350
@ LAYER_GP_OVERLAY
General purpose overlay.
Definition: layer_ids.h:278
@ LAYER_TRACKS
Definition: layer_ids.h:266
@ LAYER_CURSOR
PCB cursor.
Definition: layer_ids.h:281
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc).
Definition: layer_ids.h:282
@ LAYER_RATSNEST
Definition: layer_ids.h:252
@ LAYER_DRC_SHAPE2
Custom shape for DRC marker.
Definition: layer_ids.h:315
@ LAYER_FP_TEXT
Definition: layer_ids.h:239
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
Definition: layer_ids.h:259
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
Definition: layer_ids.h:247
@ LAYER_VIA_HOLES
Draw via holes (pad holes do not use this layer).
Definition: layer_ids.h:273
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
Definition: layer_ids.h:262
@ LAYER_VIA_MICROVIA
Definition: layer_ids.h:233
@ LAYER_SELECT_OVERLAY
Selected items overlay.
Definition: layer_ids.h:279
@ LAYER_VIA_THROUGH
Draw blind/buried vias.
Definition: layer_ids.h:235
@ LAYER_DRC_ERROR
Layer for DRC markers with #SEVERITY_ERROR.
Definition: layer_ids.h:276
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:232
@ LAYER_VIA_BBLIND
Draw micro vias.
Definition: layer_ids.h:234
@ LAYER_PAD_HOLEWALLS
Definition: layer_ids.h:296
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
@ 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
@ 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
@ 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
@ 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_1
Definition: layer_ids.h:124
@ B_SilkS
Definition: layer_ids.h:101
@ In13_Cu
Definition: layer_ids.h:78
@ In8_Cu
Definition: layer_ids.h:73
@ In14_Cu
Definition: layer_ids.h:79
@ 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:714
This file contains miscellaneous commonly used macros and functions.