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, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <algorithm>
22#include <bitset> // for bitset, __bitset<>::ref...
23#include <cassert>
24#include <cstdarg>
25#include <iostream> // for string, endl, basic_ost...
26#include <cstddef> // for size_t
27#include <map>
28
29#include <core/arraydim.h>
30#include <layer_ids.h> // for PCB_LAYER_ID
31#include <layer_range.h>
32#include <lseq.h>
33#include <macros.h> // for arrayDim
34#include <wx/debug.h> // for wxASSERT, wxASSERT_MSG
35#include <wx/string.h>
36
37#include <lset.h>
38
39
40LSET::LSET( std::initializer_list<PCB_LAYER_ID> aList ) :
41 LSET()
42{
43 for( PCB_LAYER_ID layer : aList )
44 {
45 if( layer >= 0 )
46 set( layer );
47 }
48}
49
50LSET::LSET( const std::vector<PCB_LAYER_ID>& aList ) :
51 LSET()
52{
53 for( PCB_LAYER_ID layer : aList )
54 {
55 if( layer >= 0 )
56 set( layer );
57 }
58}
59
60
61LSET::LSET( const LSEQ& aSeq ) :
62 LSET()
63{
64 for( PCB_LAYER_ID layer : aSeq )
65 {
66 if( layer >= 0 )
67 set( layer );
68 }
69}
70
71
72LSET::LSET( const LAYER_RANGE& aRange )
73{
74 for( PCB_LAYER_ID layer : aRange )
75 {
76 if( layer >= 0 )
77 set( layer );
78 }
79}
80
81
82int LSET::LayerCount( PCB_LAYER_ID aStart, PCB_LAYER_ID aEnd, int aCopperLayerCount )
83{
84 int start = aStart;
85 int end = aEnd;
86
87 // Both layers need to be copper
88 wxCHECK( IsCopperLayer( aStart ) && IsCopperLayer( aEnd ), aCopperLayerCount );
89
90 if( aStart == B_Cu )
91 std::swap( start, end );
92
93 if( aStart == aEnd )
94 return 1;
95
96 if( aStart == F_Cu )
97 {
98 if ( aEnd == B_Cu )
99 return aCopperLayerCount;
100 else
101 return ( end - start ) / 2 - 1;
102 }
103 else if ( aEnd == B_Cu )
104 {
105 // Add 1 for the B_Cu layer
106 return aCopperLayerCount - start / 2 + 1;
107 }
108
109 return ( end - start ) / 2;
110}
111
112
113int LSET::NameToLayer( wxString& aName )
114{
115 std::map<wxString, PCB_LAYER_ID> layerMap = {
116 { "F.Cu", F_Cu },
117 { "B.Cu", B_Cu },
118 { "F.Adhes", F_Adhes },
119 { "B.Adhes", B_Adhes },
120 { "F.Paste", F_Paste },
121 { "B.Paste", B_Paste },
122 { "F.SilkS", F_SilkS },
123 { "B.SilkS", B_SilkS },
124 { "F.Mask", F_Mask },
125 { "B.Mask", B_Mask },
126 { "Dwgs.User", Dwgs_User },
127 { "Cmts.User", Cmts_User },
128 { "Eco1.User", Eco1_User },
129 { "Eco2.User", Eco2_User },
130 { "Edge.Cuts", Edge_Cuts },
131 { "Margin", Margin },
132 { "F.CrtYd", F_CrtYd },
133 { "B.CrtYd", B_CrtYd },
134 { "F.Fab", F_Fab },
135 { "B.Fab", B_Fab },
136 { "Rescue", Rescue },
137 { "B.Cu", B_Cu },
138 };
139
140 if( auto it = layerMap.find( aName ); it != layerMap.end() )
141 return static_cast<int>( it->second );
142
143 if( aName.StartsWith( "User." ) )
144 {
145 long offset;
146
147 if( aName.Mid( 5 ).ToLong( &offset ) && offset > 0 )
148 return static_cast<int>( User_1 ) + ( offset - 1 ) * 2;
149 }
150
151 if( aName.StartsWith( "In" ) )
152 {
153 long offset;
154 wxString str_num = aName.Mid( 2 );
155 str_num.RemoveLast( 3 ); // Removes .Cu
156
157 if( str_num.ToLong( &offset ) && offset > 0 )
158 return static_cast<int>( In1_Cu ) + ( offset - 1 ) * 2;
159 }
160
161 return -1;
162}
163
164
166{
167 if( aLayer == aStart || aLayer == aEnd )
168 return true;
169
170 int start = std::min( aStart, aEnd );
171 int end = std::max( aStart, aEnd );
172 int layer = aLayer;
173
174 if( end == B_Cu )
175 {
176 //Reassign the end layer to the largest possible positive even number
177 end = std::numeric_limits<PCB_LAYER_ID>::max() & ~1;
178 }
179
180 return !( layer & 1 ) && ( layer >= start ) && ( layer <= end );
181}
182
183
184wxString LSET::Name( PCB_LAYER_ID aLayerId )
185{
186 wxString txt;
187
188 // using a switch to explicitly show the mapping more clearly
189 switch( aLayerId )
190 {
191 case F_Cu: txt = wxT( "F.Cu" ); break;
192 case B_Cu: txt = wxT( "B.Cu" ); break;
193
194 // Technicals
195 case B_Adhes: txt = wxT( "B.Adhes" ); break;
196 case F_Adhes: txt = wxT( "F.Adhes" ); break;
197 case B_Paste: txt = wxT( "B.Paste" ); break;
198 case F_Paste: txt = wxT( "F.Paste" ); break;
199 case B_SilkS: txt = wxT( "B.SilkS" ); break;
200 case F_SilkS: txt = wxT( "F.SilkS" ); break;
201 case B_Mask: txt = wxT( "B.Mask" ); break;
202 case F_Mask: txt = wxT( "F.Mask" ); break;
203
204 // Users
205 case Dwgs_User: txt = wxT( "Dwgs.User" ); break;
206 case Cmts_User: txt = wxT( "Cmts.User" ); break;
207 case Eco1_User: txt = wxT( "Eco1.User" ); break;
208 case Eco2_User: txt = wxT( "Eco2.User" ); break;
209 case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
210 case Margin: txt = wxT( "Margin" ); break;
211
212 // Footprint
213 case F_CrtYd: txt = wxT( "F.CrtYd" ); break;
214 case B_CrtYd: txt = wxT( "B.CrtYd" ); break;
215 case F_Fab: txt = wxT( "F.Fab" ); break;
216 case B_Fab: txt = wxT( "B.Fab" ); break;
217
218 // Rescue
219 case Rescue: txt = wxT( "Rescue" ); break;
220
221 default:
222 if( aLayerId < 0 )
223 {
224 txt = wxT( "UNDEFINED" );
225 }
226 else if( static_cast<int>( aLayerId ) & 1 )
227 {
228 int offset = ( aLayerId - Rescue ) / 2;
229
230#if wxUSE_UNICODE_WCHAR
231 std::wstring offsetStr = std::to_wstring( offset );
232#else
233 std::string offsetStr = std::to_string( offset );
234#endif
235
236 txt = wxS( "User." );
237 txt << offsetStr;
238 }
239 else
240 {
241 int offset = ( aLayerId - B_Cu ) / 2;
242
243#if wxUSE_UNICODE_WCHAR
244 std::wstring offsetStr = std::to_wstring( offset );
245#else
246 std::string offsetStr = std::to_string( offset );
247#endif
248
249 txt = wxS( "In" );
250 txt << offsetStr;
251 txt << wxS( ".Cu" );
252 }
253 }
254
255 return txt;
256}
257
258
260{
261 LSEQ ret;
262
263 ret.reserve( 32 );
264
265 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
266 ret.push_back( *it );
267
268 return ret;
269}
270
271
273{
274 LSEQ ret;
275
276 ret.reserve( 32 );
277
278 ret = Seq( {
279 F_Adhes,
280 B_Adhes,
281 F_Paste,
282 B_Paste,
283 F_SilkS,
284 B_SilkS,
285 F_Mask,
286 B_Mask,
287 Dwgs_User,
288 Cmts_User,
289 Eco1_User,
290 Eco2_User,
291 Edge_Cuts,
292 Margin,
293 F_CrtYd,
294 B_CrtYd,
295 F_Fab,
296 B_Fab
297 } );
298
299 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
300 {
301 if( *it >= User_1 )
302 ret.push_back( *it );
303 }
304
305 return ret;
306}
307
308
309LSEQ LSET::Seq( const LSEQ& aSequence ) const
310{
311 LSEQ ret;
312
313 for( PCB_LAYER_ID layer : aSequence )
314 {
315 if( test( layer ) )
316 ret.push_back( layer );
317 }
318
319 return ret;
320}
321
322
324{
325 LSEQ ret;
326
327 ret.reserve( size() );
328
329 for( unsigned i = 0; i < size(); ++i )
330 {
331 if( test( i ) )
332 ret.push_back( PCB_LAYER_ID( i ) );
333 }
334
335 return ret;
336}
337
338
340{
341 LSEQ base_sequence = Seq( {
342 Edge_Cuts,
343 Margin,
344 Dwgs_User,
345 Cmts_User,
346 Eco1_User,
348 } );
349
350 LSEQ top_tech_sequence = Seq( {
351 F_Fab,
352 F_SilkS,
353 F_Paste,
354 F_Adhes,
355 F_Mask,
356 F_CrtYd,
357 } );
358
359 LSEQ bottom_tech_sequence = Seq( {
360 B_CrtYd,
361 B_Mask,
362 B_Adhes,
363 B_Paste,
364 B_SilkS,
365 B_Fab,
366 } );
367
368
369 LSEQ seq = Seq( base_sequence );
370
371 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
372 {
373 if( *it >= User_1 )
374 seq.push_back( *it );
375 }
376
377 std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
378
379 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
380 seq.push_back( *it );
381
382 std::copy( bottom_tech_sequence.begin(), bottom_tech_sequence.end(),
383 std::back_inserter( seq ) );
384
385 if( aSelectedLayer != UNDEFINED_LAYER )
386 {
387 auto it = std::find( seq.begin(), seq.end(), aSelectedLayer );
388
389 if( it != seq.end() )
390 {
391 seq.erase( it );
392 seq.insert( seq.begin(), aSelectedLayer );
393 }
394 }
395
396 return seq;
397}
398
399
401{
402 // bottom-to-top stack-up layers
403 // Note that the bottom technical layers are flipped so that when plotting a bottom-side view,
404 // they appear in the correct sequence.
405 LSEQ bottom_tech_sequence = Seq( {
406 B_Cu,
407 B_Mask,
408 B_Paste,
409 B_SilkS,
410 B_Adhes,
411 B_CrtYd,
412 B_Fab,
413 } );
414
415 // Copper layers go here
416
417 LSEQ top_tech_sequence = Seq( {
418 F_Mask,
419 F_Paste,
420 F_SilkS,
421 F_Adhes,
422 F_CrtYd,
423 F_Fab,
424 } );
425
426 LSEQ user_sequence = Seq( {
427 Dwgs_User,
428 Cmts_User,
429 Eco1_User,
430 Eco2_User,
431 } );
432
433 // User layers go here
434
435 LSEQ base_sequence = Seq( {
436 Margin,
437 Edge_Cuts,
438 } );
439
440
441
442 LSEQ seq = Seq( bottom_tech_sequence );
443
444 std::vector<PCB_LAYER_ID> temp_layers;
445
446 // We are going to reverse the copper layers and then add them to the sequence
447 // because the plotting order is bottom-to-top
448 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
449 {
450 // Skip B_Cu because it is already in the sequence (if it exists)
451 if( *it != B_Cu )
452 temp_layers.push_back( *it );
453 }
454
455 for( auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
456 seq.push_back( *it );
457
458 std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
459
460 std::copy( user_sequence.begin(), user_sequence.end(), std::back_inserter( seq ) );
461
462 temp_layers.clear();
463
464 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
465 {
466 if( *it >= User_1 )
467 temp_layers.push_back( *it );
468 }
469
470 for( auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
471 {
472 seq.push_back( *it );
473 }
474
475 std::copy( base_sequence.begin(), base_sequence.end(), std::back_inserter( seq ) );
476
477 return seq;
478}
479
480
481LSET& LSET::FlipStandardLayers( int aCopperLayersCount )
482{
483 LSET oldMask = *this;
484
485 reset();
486
487 // Mapping for Copper and Non-Copper layers
488 const std::map<PCB_LAYER_ID, PCB_LAYER_ID> flip_map =
489 {
490 {F_Cu, B_Cu},
491 {B_Cu, F_Cu},
492 {F_SilkS, B_SilkS},
493 {B_SilkS, F_SilkS},
494 {F_Adhes, B_Adhes},
495 {B_Adhes, F_Adhes},
496 {F_Mask, B_Mask},
497 {B_Mask, F_Mask},
498 {F_Paste, B_Paste},
499 {B_Paste, F_Paste},
500 {F_CrtYd, B_CrtYd},
501 {B_CrtYd, F_CrtYd},
502 {F_Fab, B_Fab},
503 {B_Fab, F_Fab}
504 };
505
506 for( const auto& pair : flip_map )
507 {
508 if( oldMask.test( pair.first ) )
509 set( pair.second );
510
511 oldMask.set( pair.first, false );
512 }
513
514 if( aCopperLayersCount >= 4 )
515 {
516 LSET internalMask = oldMask & InternalCuMask();
517 int innerLayerCount = aCopperLayersCount - 2;
518
519 for( int ii = 1; ii <= innerLayerCount; ii++ )
520 {
521 if( internalMask.test( ( innerLayerCount - ii + 1 ) * 2 + B_Cu ) )
522 {
523 set( ii * 2 + B_Cu );
524 }
525 }
526 }
527
528 oldMask.ClearCopperLayers();
529
530 // Copy across any remaining, non-side-specific layers
531 for( PCB_LAYER_ID layer : oldMask )
532 set( layer );
533
534 return *this;
535}
536
537
539{
540 unsigned set_count = count();
541
542 if( !set_count )
543 return UNSELECTED_LAYER;
544 else if( set_count > 1 )
545 return UNDEFINED_LAYER;
546
547 for( unsigned i=0; i < size(); ++i )
548 {
549 if( test( i ) )
550 return PCB_LAYER_ID( i );
551 }
552
553 wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
554
555 return UNDEFINED_LAYER;
556}
557
558
560{
561 static LSET saved( { F_SilkS, F_Mask, F_Fab, F_CrtYd } );
562 return saved;
563}
564
565
567{
568 static LSET saved( { B_SilkS, B_Mask, B_Fab, B_CrtYd } );
569 return saved;
570}
571
572
582
583
584LSET allCuMask( int aCuLayerCount )
585{
586 LSET ret;
587
588 for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu, aCuLayerCount ) )
589 ret.set( layer );
590
591 return ret;
592}
593
594
595LSET LSET::AllCuMask( int aCuLayerCount )
596{
597 if( aCuLayerCount == MAX_CU_LAYERS )
598 return AllCuMask();
599
600 return allCuMask( aCuLayerCount );
601}
602
603
605{
606 static LSET s_savedMax = allCuMask( MAX_CU_LAYERS );
607
608 return s_savedMax;
609}
610
611
613{
614 LSET mask = LSET().set();
615
616 for( auto it = mask.copper_layers_begin(); it != mask.copper_layers_end(); ++it )
617 mask.reset( *it );
618
619 return mask;
620}
621
622
624{
625 static LSET saved = allNonCuMask();
626 return saved;
627}
628
629
631{
632 static LSET saved( { F_Cu, B_Cu } );
633 return saved;
634}
635
636
638{
639 static LSET saved = LSET().set();
640 return saved;
641}
642
643
645{
646 static LSET saved( { B_SilkS, B_Mask, B_Adhes, B_Paste, B_CrtYd, B_Fab } );
647 return saved;
648}
649
650
652{
653 static LSET saved( { B_SilkS, B_Mask, B_Adhes, B_Paste } );
654 return saved;
655}
656
657
659{
660 static LSET saved( { F_SilkS, F_Mask, F_Adhes, F_Paste, F_CrtYd, F_Fab } );
661 return saved;
662}
663
664
666{
667 static LSET saved( { F_SilkS, F_Mask, F_Adhes, F_Paste } );
668 return saved;
669}
670
671
673{
674 static LSET saved = BackTechMask() | FrontTechMask();
675 return saved;
676}
677
678
680{
681 static LSET saved = BackBoardTechMask() | FrontBoardTechMask();
682 return saved;
683}
684
685
687{
688 static LSET saved( { Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts, Margin } );
689 return saved;
690}
691
692
694{
695 static LSET saved = AllBoardTechMask() | AllCuMask();
696 return saved;
697}
698
699
700LSET LSET::UserDefinedLayersMask( int aUserDefinedLayerCount )
701{
702 LSET ret;
703 size_t layer = User_1;
704
705 for( int ulayer = 1; ulayer <= aUserDefinedLayerCount; ulayer++ )
706 {
707 if( layer > ret.size() )
708 break;
709
710 ret.set( layer );
711 layer += 2;
712 }
713
714 return ret;
715}
716
717
719{
720 static LSET saved = LSET( FrontTechMask() ).set( F_Cu );
721 return saved;
722}
723
724
726{
727 static LSET saved = LSET( BackTechMask() ).set( B_Cu );
728 return saved;
729}
730
731
733{
734 static LSET saved = BackTechMask() | FrontTechMask() | AllCuMask();
735 return saved;
736}
737
738
740{
741 LSEQ order = CuStack();
742 LSEQ techuser = TechAndUserUIOrder();
743
744 order.insert( order.end(), techuser.begin(), techuser.end() );
745
746 return order;
747}
748
749
751{
752 // We use std::numeric_limits<int>::max() to represent B_Cu for the connectivity_rtree
753 if( aLayer == std::numeric_limits<int>::max() )
754 return B_Cu;
755
756 wxASSERT( aLayer < GAL_LAYER_ID_END );
757 return PCB_LAYER_ID( aLayer );
758}
759
760
761GAL_SET::GAL_SET( const GAL_LAYER_ID* aArray, unsigned aCount ) : GAL_SET()
762{
763 for( unsigned i = 0; i < aCount; ++i )
764 set( aArray[i] );
765}
766
767
768std::vector<GAL_LAYER_ID> GAL_SET::Seq() const
769{
770 std::vector<GAL_LAYER_ID> ret;
771
772 for( size_t i = 0; i < size(); ++i )
773 {
774 if( test( i ) )
775 ret.push_back( static_cast<GAL_LAYER_ID>( i + GAL_LAYER_ID_START ) );
776 }
777
778 return ret;
779}
780
781
783{
784 static const GAL_LAYER_ID visible[] = {
790 // LAYER_HIDDEN_TEXT, // DEPCREATED SINCE 9.0. Invisible text hidden by default
809 // LAYER_DRC_EXCLUSION, // DRC exclusions hidden by default
821 // LAYER_BOARD_OUTLINE_AREA, // currently hidden by default
824 };
825
826 static const GAL_SET saved( visible, arrayDim( visible ) );
827 return saved;
828}
829
830
831// Custom iterators for Copper and Non-Copper layers
832
839
840
842{
843 return static_cast<PCB_LAYER_ID>( m_index );
844}
845
846
853
854
856{
857 if( m_index == F_Cu )
858 {
859 m_index += 4;
860 }
861 else if( m_index == B_Cu )
862 {
863 m_index = m_baseSet.size();
864 return;
865 }
866 else
867 {
868 m_index += 2;
869
870 if( m_index >= m_baseSet.size() )
871 m_index = B_Cu;
872 }
873}
874
875
881
882
888
889
894
895
902
903
905{
906 while( m_index < m_baseSet.size() && ( m_index % 2 != 1 || !m_baseSet.test( m_index ) ) )
907 {
908 ++m_index;
909 }
910}
911
912
917
918
923
924
929
930
935
936
938{
939 for( size_t ii = 0; ii < size(); ii += 2 )
940 reset( ii );
941
942 return *this;
943}
944
945
947{
948 for( size_t ii = 1; ii < size(); ii += 2 )
949 reset( ii );
950
951 return *this;
952}
953
954
956{
957 for( size_t ii = User_1; ii < size(); ii += 2 )
958 reset( ii );
959
960 return *this;
961}
int index
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition arraydim.h:27
const BASE_SET & m_baseSet
Definition base_set.h:449
set_bits_iterator(const BASE_SET &baseSet, size_t index)
Definition base_set.h:423
BASE_SET & reset(size_t pos)
Definition base_set.h:143
BASE_SET(size_t size=64)
Definition base_set.h:111
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
GAL_SET & set()
Definition layer_ids.h:417
static GAL_SET DefaultVisible()
Definition lset.cpp:782
std::vector< GAL_LAYER_ID > Seq() const
Definition lset.cpp:768
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition lseq.h:47
copper_layers_iterator & operator++()
Definition lset.cpp:847
PCB_LAYER_ID operator*() const
Definition lset.cpp:841
void advance_to_next_set_copper_bit()
Definition lset.cpp:876
copper_layers_iterator(const BASE_SET &set, size_t index)
Definition lset.cpp:833
PCB_LAYER_ID operator*() const
Definition lset.cpp:890
non_copper_layers_iterator & operator++()
Definition lset.cpp:896
non_copper_layers_iterator(const BASE_SET &set, size_t index)
Definition lset.cpp:883
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
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:165
static const LSET & FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
Definition lset.cpp:718
static const LSET & AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
Definition lset.cpp:679
static const LSET & BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
Definition lset.cpp:566
copper_layers_iterator copper_layers_end() const
Definition lset.cpp:919
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:604
static const LSET & FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
Definition lset.cpp:665
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
Definition lset.cpp:739
static const LSET & BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition lset.cpp:725
static const LSET & FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
Definition lset.cpp:559
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition lset.cpp:259
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
Definition lset.cpp:538
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
Definition lset.cpp:400
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition lset.cpp:623
LSEQ TechAndUserUIOrder() const
Return the technical and user layers in the order shown in layer widget.
Definition lset.cpp:272
static const LSET & BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
Definition lset.cpp:644
static const LSET & UserMask()
Definition lset.cpp:686
LSET & ClearUserDefinedLayers()
Clear the user defined layers in this set.
Definition lset.cpp:955
static const LSET & SideSpecificMask()
Definition lset.cpp:732
LSET & ClearNonCopperLayers()
Clear the non-copper layers in this set.
Definition lset.cpp:946
all_set_layers_iterator end() const
Definition lset.h:334
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition lset.cpp:323
static const LSET & ExternalCuMask()
Return a mask holding the Front and Bottom layers.
Definition lset.cpp:630
copper_layers_iterator copper_layers_begin() const
Definition lset.cpp:913
non_copper_layers_iterator non_copper_layers_begin() const
Definition lset.cpp:925
LSET & FlipStandardLayers(int aCopperLayersCount=0)
Flip the layers in this set.
Definition lset.cpp:481
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
Definition lset.cpp:113
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition lset.cpp:672
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:339
non_copper_layers_iterator non_copper_layers_end() const
Definition lset.cpp:931
LSET & ClearCopperLayers()
Clear the copper layers in this set.
Definition lset.cpp:937
static const LSET & AllLayersMask()
Definition lset.cpp:637
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition lset.cpp:700
static const LSET & PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
Definition lset.cpp:693
static const LSET & BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
Definition lset.cpp:651
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Definition lset.cpp:573
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition lset.cpp:184
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:82
static const LSET & FrontTechMask()
Return a mask holding all technical layers (no CU layer) on front side.
Definition lset.cpp:658
#define MAX_CU_LAYERS
Definition layer_ids.h:172
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition layer_ids.h:675
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition layer_ids.h:224
@ LAYER_GRID
Definition layer_ids.h:250
@ LAYER_POINTS
PCB reference/manual snap points visibility.
Definition layer_ids.h:317
@ GAL_LAYER_ID_START
Definition layer_ids.h:225
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
Definition layer_ids.h:303
@ LAYER_VIA_HOLEWALLS
Definition layer_ids.h:294
@ LAYER_GRID_AXES
Definition layer_ids.h:251
@ LAYER_FILLED_SHAPES
Copper graphic shape opacity/visibility (color ignored).
Definition layer_ids.h:309
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
Definition layer_ids.h:306
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
Definition layer_ids.h:255
@ LAYER_NON_PLATEDHOLES
Draw usual through hole vias.
Definition layer_ids.h:235
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition layer_ids.h:274
@ LAYER_DRAW_BITMAPS
Draw images.
Definition layer_ids.h:280
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
Definition layer_ids.h:262
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition layer_ids.h:277
@ LAYER_ZONES
Control for copper zone opacity/visibility (color ignored).
Definition layer_ids.h:291
@ LAYER_DRC_SHAPES
Custom shapes for DRC markers.
Definition layer_ids.h:311
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
Definition layer_ids.h:288
@ LAYER_DRC_WARNING
Layer for DRC markers with #SEVERITY_WARNING.
Definition layer_ids.h:297
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
Definition layer_ids.h:267
@ GAL_LAYER_ID_END
Definition layer_ids.h:358
@ LAYER_GP_OVERLAY
General purpose overlay.
Definition layer_ids.h:275
@ LAYER_TRACKS
Definition layer_ids.h:263
@ LAYER_CURSOR
PCB cursor.
Definition layer_ids.h:278
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc).
Definition layer_ids.h:279
@ LAYER_RATSNEST
Definition layer_ids.h:249
@ LAYER_FP_TEXT
Definition layer_ids.h:236
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
Definition layer_ids.h:256
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
Definition layer_ids.h:244
@ LAYER_VIA_BURIED
Draw blind vias.
Definition layer_ids.h:231
@ LAYER_VIA_HOLES
Draw via holes (pad holes do not use this layer).
Definition layer_ids.h:270
@ LAYER_VIA_BLIND
Draw micro vias.
Definition layer_ids.h:230
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
Definition layer_ids.h:259
@ LAYER_VIA_MICROVIA
Definition layer_ids.h:229
@ LAYER_SELECT_OVERLAY
Selected items overlay.
Definition layer_ids.h:276
@ LAYER_VIA_THROUGH
Draw buried vias.
Definition layer_ids.h:232
@ LAYER_DRC_ERROR
Layer for DRC markers with #SEVERITY_ERROR.
Definition layer_ids.h:273
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition layer_ids.h:228
@ LAYER_PAD_HOLEWALLS
Definition layer_ids.h:293
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ In22_Cu
Definition layer_ids.h:83
@ In11_Cu
Definition layer_ids.h:72
@ In29_Cu
Definition layer_ids.h:90
@ In30_Cu
Definition layer_ids.h:91
@ F_CrtYd
Definition layer_ids.h:112
@ In17_Cu
Definition layer_ids.h:78
@ B_Adhes
Definition layer_ids.h:99
@ Edge_Cuts
Definition layer_ids.h:108
@ Dwgs_User
Definition layer_ids.h:103
@ F_Paste
Definition layer_ids.h:100
@ In9_Cu
Definition layer_ids.h:70
@ Cmts_User
Definition layer_ids.h:104
@ In19_Cu
Definition layer_ids.h:80
@ In7_Cu
Definition layer_ids.h:68
@ In28_Cu
Definition layer_ids.h:89
@ In26_Cu
Definition layer_ids.h:87
@ F_Adhes
Definition layer_ids.h:98
@ B_Mask
Definition layer_ids.h:94
@ B_Cu
Definition layer_ids.h:61
@ Eco1_User
Definition layer_ids.h:105
@ F_Mask
Definition layer_ids.h:93
@ In21_Cu
Definition layer_ids.h:82
@ In23_Cu
Definition layer_ids.h:84
@ B_Paste
Definition layer_ids.h:101
@ In15_Cu
Definition layer_ids.h:76
@ In2_Cu
Definition layer_ids.h:63
@ UNSELECTED_LAYER
Definition layer_ids.h:58
@ F_Fab
Definition layer_ids.h:115
@ In10_Cu
Definition layer_ids.h:71
@ Margin
Definition layer_ids.h:109
@ F_SilkS
Definition layer_ids.h:96
@ In4_Cu
Definition layer_ids.h:65
@ B_CrtYd
Definition layer_ids.h:111
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ Eco2_User
Definition layer_ids.h:106
@ In16_Cu
Definition layer_ids.h:77
@ In24_Cu
Definition layer_ids.h:85
@ In1_Cu
Definition layer_ids.h:62
@ Rescue
Definition layer_ids.h:117
@ User_1
Definition layer_ids.h:120
@ B_SilkS
Definition layer_ids.h:97
@ In13_Cu
Definition layer_ids.h:74
@ In8_Cu
Definition layer_ids.h:69
@ In14_Cu
Definition layer_ids.h:75
@ In12_Cu
Definition layer_ids.h:73
@ In27_Cu
Definition layer_ids.h:88
@ In6_Cu
Definition layer_ids.h:67
@ In5_Cu
Definition layer_ids.h:66
@ In3_Cu
Definition layer_ids.h:64
@ In20_Cu
Definition layer_ids.h:81
@ F_Cu
Definition layer_ids.h:60
@ In18_Cu
Definition layer_ids.h:79
@ In25_Cu
Definition layer_ids.h:86
@ B_Fab
Definition layer_ids.h:114
LSET allCuMask(int aCuLayerCount)
Definition lset.cpp:584
LSET allNonCuMask()
Definition lset.cpp:612
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition lset.cpp:750
This file contains miscellaneous commonly used macros and functions.