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