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 txt = wxString::Format( wxT( "User.%d" ), offset );
234 }
235 else
236 {
237 int offset = ( aLayerId - B_Cu ) / 2;
238 txt = wxString::Format( wxT( "In%d.Cu" ), offset );
239 }
240 }
241
242 return txt;
243}
244
245
247{
248 LSEQ ret;
249
250 ret.reserve( 32 );
251
252 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
253 ret.push_back( *it );
254
255 return ret;
256}
257
258
260{
261 LSEQ ret;
262
263 ret.reserve( 32 );
264
265 ret = Seq( {
266 F_Adhes,
267 B_Adhes,
268 F_Paste,
269 B_Paste,
270 F_SilkS,
271 B_SilkS,
272 F_Mask,
273 B_Mask,
274 Dwgs_User,
275 Cmts_User,
276 Eco1_User,
277 Eco2_User,
278 Edge_Cuts,
279 Margin,
280 F_CrtYd,
281 B_CrtYd,
282 F_Fab,
283 B_Fab
284 } );
285
286 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
287 {
288 if( *it >= User_1 )
289 ret.push_back( *it );
290 }
291
292 return ret;
293}
294
295
296LSEQ LSET::Seq( const LSEQ& aSequence ) const
297{
298 LSEQ ret;
299
300 for( PCB_LAYER_ID layer : aSequence )
301 {
302 if( test( layer ) )
303 ret.push_back( layer );
304 }
305
306 return ret;
307}
308
309
311{
312 LSEQ ret;
313
314 ret.reserve( size() );
315
316 for( unsigned i = 0; i < size(); ++i )
317 {
318 if( test( i ) )
319 ret.push_back( PCB_LAYER_ID( i ) );
320 }
321
322 return ret;
323}
324
325
327{
328 LSEQ base_sequence = Seq( {
329 Edge_Cuts,
330 Margin,
331 Dwgs_User,
332 Cmts_User,
333 Eco1_User,
335 } );
336
337 LSEQ top_tech_sequence = Seq( {
338 F_Fab,
339 F_SilkS,
340 F_Paste,
341 F_Adhes,
342 F_Mask,
343 F_CrtYd,
344 } );
345
346 LSEQ bottom_tech_sequence = Seq( {
347 B_CrtYd,
348 B_Mask,
349 B_Adhes,
350 B_Paste,
351 B_SilkS,
352 B_Fab,
353 } );
354
355
356 LSEQ seq = Seq( base_sequence );
357
358 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
359 {
360 if( *it >= User_1 )
361 seq.push_back( *it );
362 }
363
364 std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
365
366 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
367 seq.push_back( *it );
368
369 std::copy( bottom_tech_sequence.begin(), bottom_tech_sequence.end(),
370 std::back_inserter( seq ) );
371
372 if( aSelectedLayer != UNDEFINED_LAYER )
373 {
374 auto it = std::find( seq.begin(), seq.end(), aSelectedLayer );
375
376 if( it != seq.end() )
377 {
378 seq.erase( it );
379 seq.insert( seq.begin(), aSelectedLayer );
380 }
381 }
382
383 return seq;
384}
385
386
388{
389 // bottom-to-top stack-up layers
390 // Note that the bottom technical layers are flipped so that when plotting a bottom-side view,
391 // they appear in the correct sequence.
392 LSEQ bottom_tech_sequence = Seq( {
393 B_Cu,
394 B_Mask,
395 B_Paste,
396 B_SilkS,
397 B_Adhes,
398 B_CrtYd,
399 B_Fab,
400 } );
401
402 // Copper layers go here
403
404 LSEQ top_tech_sequence = Seq( {
405 F_Mask,
406 F_Paste,
407 F_SilkS,
408 F_Adhes,
409 F_CrtYd,
410 F_Fab,
411 } );
412
413 LSEQ user_sequence = Seq( {
414 Dwgs_User,
415 Cmts_User,
416 Eco1_User,
417 Eco2_User,
418 } );
419
420 // User layers go here
421
422 LSEQ base_sequence = Seq( {
423 Margin,
424 Edge_Cuts,
425 } );
426
427
428
429 LSEQ seq = Seq( bottom_tech_sequence );
430
431 std::vector<PCB_LAYER_ID> temp_layers;
432
433 // We are going to reverse the copper layers and then add them to the sequence
434 // because the plotting order is bottom-to-top
435 for( auto it = copper_layers_begin(); it != copper_layers_end(); ++it )
436 {
437 // Skip B_Cu because it is already in the sequence (if it exists)
438 if( *it != B_Cu )
439 temp_layers.push_back( *it );
440 }
441
442 for( auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
443 seq.push_back( *it );
444
445 std::copy( top_tech_sequence.begin(), top_tech_sequence.end(), std::back_inserter( seq ) );
446
447 std::copy( user_sequence.begin(), user_sequence.end(), std::back_inserter( seq ) );
448
449 temp_layers.clear();
450
451 for( auto it = non_copper_layers_begin(); it != non_copper_layers_end(); ++it )
452 {
453 if( *it >= User_1 )
454 temp_layers.push_back( *it );
455 }
456
457 for( auto it = temp_layers.rbegin(); it != temp_layers.rend(); ++it )
458 {
459 seq.push_back( *it );
460 }
461
462 std::copy( base_sequence.begin(), base_sequence.end(), std::back_inserter( seq ) );
463
464 return seq;
465}
466
467
468LSET& LSET::FlipStandardLayers( int aCopperLayersCount )
469{
470 LSET oldMask = *this;
471
472 reset();
473
474 // Mapping for Copper and Non-Copper layers
475 const std::map<PCB_LAYER_ID, PCB_LAYER_ID> flip_map =
476 {
477 {F_Cu, B_Cu},
478 {B_Cu, F_Cu},
479 {F_SilkS, B_SilkS},
480 {B_SilkS, F_SilkS},
481 {F_Adhes, B_Adhes},
482 {B_Adhes, F_Adhes},
483 {F_Mask, B_Mask},
484 {B_Mask, F_Mask},
485 {F_Paste, B_Paste},
486 {B_Paste, F_Paste},
487 {F_CrtYd, B_CrtYd},
488 {B_CrtYd, F_CrtYd},
489 {F_Fab, B_Fab},
490 {B_Fab, F_Fab}
491 };
492
493 for( const auto& pair : flip_map )
494 {
495 if( oldMask.test( pair.first ) )
496 set( pair.second );
497
498 oldMask.set( pair.first, false );
499 }
500
501 if( aCopperLayersCount >= 4 )
502 {
503 LSET internalMask = oldMask & InternalCuMask();
504 int innerLayerCount = aCopperLayersCount - 2;
505
506 for( int ii = 1; ii <= innerLayerCount; ii++ )
507 {
508 if( internalMask.test( ( innerLayerCount - ii + 1 ) * 2 + B_Cu ) )
509 {
510 set( ii * 2 + B_Cu );
511 }
512 }
513 }
514
515 oldMask.ClearCopperLayers();
516
517 // Copy across any remaining, non-side-specific layers
518 for( PCB_LAYER_ID layer : oldMask )
519 set( layer );
520
521 return *this;
522}
523
524
526{
527 unsigned set_count = count();
528
529 if( !set_count )
530 return UNSELECTED_LAYER;
531 else if( set_count > 1 )
532 return UNDEFINED_LAYER;
533
534 for( unsigned i=0; i < size(); ++i )
535 {
536 if( test( i ) )
537 return PCB_LAYER_ID( i );
538 }
539
540 wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
541
542 return UNDEFINED_LAYER;
543}
544
545
547{
548 static LSET saved( { F_SilkS, F_Mask, F_Fab, F_CrtYd } );
549 return saved;
550}
551
552
554{
555 static LSET saved( { B_SilkS, B_Mask, B_Fab, B_CrtYd } );
556 return saved;
557}
558
559
561{
562 static LSET saved( { In1_Cu, In2_Cu, In3_Cu, In4_Cu, In5_Cu, In6_Cu,
567 return saved;
568}
569
570
571LSET allCuMask( int aCuLayerCount )
572{
573 LSET ret;
574
575 for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu, aCuLayerCount ) )
576 ret.set( layer );
577
578 return ret;
579}
580
581
582LSET LSET::AllCuMask( int aCuLayerCount )
583{
584 if( aCuLayerCount == MAX_CU_LAYERS )
585 return AllCuMask();
586
587 return allCuMask( aCuLayerCount );
588}
589
590
592{
593 static LSET s_savedMax = allCuMask( MAX_CU_LAYERS );
594
595 return s_savedMax;
596}
597
598
600{
601 LSET mask = LSET().set();
602
603 for( auto it = mask.copper_layers_begin(); it != mask.copper_layers_end(); ++it )
604 mask.reset( *it );
605
606 return mask;
607}
608
609
611{
612 static LSET saved = allNonCuMask();
613 return saved;
614}
615
616
618{
619 static LSET saved( { F_Cu, B_Cu } );
620 return saved;
621}
622
623
625{
626 static LSET saved = LSET().set();
627 return saved;
628}
629
630
632{
633 static LSET saved( { B_SilkS, B_Mask, B_Adhes, B_Paste, B_CrtYd, B_Fab } );
634 return saved;
635}
636
637
639{
640 static LSET saved( { B_SilkS, B_Mask, B_Adhes, B_Paste } );
641 return saved;
642}
643
644
646{
647 static LSET saved( { F_SilkS, F_Mask, F_Adhes, F_Paste, F_CrtYd, F_Fab } );
648 return saved;
649}
650
651
653{
654 static LSET saved( { F_SilkS, F_Mask, F_Adhes, F_Paste } );
655 return saved;
656}
657
658
660{
661 static LSET saved = BackTechMask() | FrontTechMask();
662 return saved;
663}
664
665
667{
668 static LSET saved = BackBoardTechMask() | FrontBoardTechMask();
669 return saved;
670}
671
672
674{
675 static LSET saved( { Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts, Margin } );
676 return saved;
677}
678
679
681{
682 static LSET saved = AllBoardTechMask() | AllCuMask();
683 return saved;
684}
685
686
687LSET LSET::UserDefinedLayersMask( int aUserDefinedLayerCount )
688{
689 LSET ret;
690 size_t layer = User_1;
691
692 for( int ulayer = 1; ulayer <= aUserDefinedLayerCount; ulayer++ )
693 {
694 if( layer > ret.size() )
695 break;
696
697 ret.set( layer );
698 layer += 2;
699 }
700
701 return ret;
702}
703
704
706{
707 static LSET saved = LSET( FrontTechMask() ).set( F_Cu );
708 return saved;
709}
710
711
713{
714 static LSET saved = LSET( BackTechMask() ).set( B_Cu );
715 return saved;
716}
717
718
720{
721 static LSET saved = BackTechMask() | FrontTechMask() | AllCuMask();
722 return saved;
723}
724
725
727{
728 static LSET saved = LSET( InternalCuMask() ).set( In1_Cu, false );
729 return saved;
730}
731
732
734{
735 LSEQ order = CuStack();
736 LSEQ techuser = TechAndUserUIOrder();
737
738 order.insert( order.end(), techuser.begin(), techuser.end() );
739
740 return order;
741}
742
743
745{
746 // We use std::numeric_limits<int>::max() to represent B_Cu for the connectivity_rtree
747 if( aLayer == std::numeric_limits<int>::max() )
748 return B_Cu;
749
750 wxASSERT( aLayer < GAL_LAYER_ID_END );
751 return PCB_LAYER_ID( aLayer );
752}
753
754
755GAL_SET::GAL_SET( const GAL_LAYER_ID* aArray, unsigned aCount ) : GAL_SET()
756{
757 for( unsigned i = 0; i < aCount; ++i )
758 set( aArray[i] );
759}
760
761
762std::vector<GAL_LAYER_ID> GAL_SET::Seq() const
763{
764 std::vector<GAL_LAYER_ID> ret;
765
766 for( size_t i = 0; i < size(); ++i )
767 {
768 if( test( i ) )
769 ret.push_back( static_cast<GAL_LAYER_ID>( i + GAL_LAYER_ID_START ) );
770 }
771
772 return ret;
773}
774
775
777{
778 static const GAL_LAYER_ID visible[] = {
783 // LAYER_HIDDEN_TEXT, // DEPCREATED SINCE 9.0. Invisible text hidden by default
803 // LAYER_DRC_EXCLUSION, // DRC exclusions hidden by default
815 // LAYER_BOARD_OUTLINE_AREA, // currently hidden by default
817 };
818
819 static const GAL_SET saved( visible, arrayDim( visible ) );
820 return saved;
821}
822
823
824#ifndef SWIG // Skip SWIG generators for the iterators because it requires a default constructor
825// Custom iterators for Copper and Non-Copper layers
826
828 BASE_SET::set_bits_iterator( set, index )
829{
830 m_index = ( index + 1 ) & ~1;
832}
833
834
836{
837 return static_cast<PCB_LAYER_ID>( m_index );
838}
839
840
842{
843 next_copper_layer();
844 advance_to_next_set_copper_bit();
845 return *this;
846}
847
848
850{
851 if( m_index == F_Cu )
852 {
853 m_index += 4;
854 }
855 else if( m_index == B_Cu )
856 {
857 m_index = m_baseSet.size();
858 return;
859 }
860 else
861 {
862 m_index += 2;
863
864 if( m_index >= m_baseSet.size() )
865 m_index = B_Cu;
866 }
867}
868
869
871{
872 while( m_index < m_baseSet.size() && !m_baseSet.test( m_index ) )
873 next_copper_layer();
874}
875
876
879{
881}
882
883
885{
886 return static_cast<PCB_LAYER_ID>( m_index );
887}
888
889
891{
892 ++m_index;
893 advance_to_next_set_non_copper_bit();
894 return *this;
895}
896
897
899{
900 while( m_index < m_baseSet.size() && ( m_index % 2 != 1 || !m_baseSet.test( m_index ) ) )
901 {
902 ++m_index;
903 }
904}
905
906
908{
909 return copper_layers_iterator( *this, 0 );
910}
911
912
914{
915 return copper_layers_iterator( *this, size() );
916}
917
918
920{
921 return non_copper_layers_iterator( *this, 0 );
922}
923
924
926{
927 return non_copper_layers_iterator( *this, size() );
928}
929
930
932{
933 for( size_t ii = 0; ii < size(); ii += 2 )
934 reset( ii );
935
936 return *this;
937}
938
939
941{
942 for( size_t ii = 1; ii < size(); ii += 2 )
943 reset( ii );
944
945 return *this;
946}
947
948
950{
951 for( size_t ii = User_1; ii < size(); ii += 2 )
952 reset( ii );
953
954 return *this;
955}
956
957#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:393
GAL_SET()
Definition: layer_ids.h:399
GAL_SET & set()
Definition: layer_ids.h:409
static GAL_SET DefaultVisible()
Definition: lset.cpp:776
std::vector< GAL_LAYER_ID > Seq() const
Definition: lset.cpp:762
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: lseq.h:47
copper_layers_iterator & operator++()
Definition: lset.cpp:841
PCB_LAYER_ID operator*() const
Definition: lset.cpp:835
void advance_to_next_set_copper_bit()
Definition: lset.cpp:870
copper_layers_iterator(const BASE_SET &set, size_t index)
Definition: lset.cpp:827
PCB_LAYER_ID operator*() const
Definition: lset.cpp:884
non_copper_layers_iterator & operator++()
Definition: lset.cpp:890
non_copper_layers_iterator(const BASE_SET &set, size_t index)
Definition: lset.cpp:877
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:705
static const LSET & AllBoardTechMask()
Return a mask holding board technical layers (no CU layer) on both side.
Definition: lset.cpp:666
static const LSET & BackAssembly()
Return a complete set of all bottom assembly layers which is all B_SilkS and B_Mask.
Definition: lset.cpp:553
copper_layers_iterator copper_layers_end() const
Definition: lset.cpp:913
static const LSET & FrontBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on front side.
Definition: lset.cpp:652
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
Definition: lset.cpp:733
static const LSET & BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:712
static const LSET & FrontAssembly()
Return a complete set of all top assembly layers which is all F_SilkS and F_Mask.
Definition: lset.cpp:546
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:246
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
Definition: lset.cpp:525
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
Definition: lset.cpp:387
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition: lset.cpp:610
LSEQ TechAndUserUIOrder() const
Return the technical and user layers in the order shown in layer widget.
Definition: lset.cpp:259
static const LSET & BackTechMask()
Return a mask holding all technical layers (no CU layer) on back side.
Definition: lset.cpp:631
static const LSET & UserMask()
Definition: lset.cpp:673
LSET & ClearUserDefinedLayers()
Clear the user defined layers in this set.
Definition: lset.cpp:949
static const LSET & SideSpecificMask()
Definition: lset.cpp:719
LSET & ClearNonCopperLayers()
Clear the non-copper layers in this set.
Definition: lset.cpp:940
all_set_layers_iterator end() const
Definition: lset.h:332
LSEQ Seq() const
Return a LSEQ from this LSET in ascending PCB_LAYER_ID order.
Definition: lset.cpp:310
static const LSET & ExternalCuMask()
Return a mask holding the Front and Bottom layers.
Definition: lset.cpp:617
copper_layers_iterator copper_layers_begin() const
Definition: lset.cpp:907
non_copper_layers_iterator non_copper_layers_begin() const
Definition: lset.cpp:919
LSET & FlipStandardLayers(int aCopperLayersCount=0)
Flip the layers in this set.
Definition: lset.cpp:468
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:659
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:326
non_copper_layers_iterator non_copper_layers_end() const
Definition: lset.cpp:925
LSET & ClearCopperLayers()
Clear the copper layers in this set.
Definition: lset.cpp:931
static const LSET & ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
Definition: lset.cpp:726
static const LSET & AllLayersMask()
Definition: lset.cpp:624
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition: lset.cpp:687
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition: lset.cpp:591
static const LSET & PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
Definition: lset.cpp:680
static const LSET & BackBoardTechMask()
Return a mask holding technical layers used in a board fabrication (no CU layer) on Back side.
Definition: lset.cpp:638
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:560
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:645
#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:665
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_FILLED_SHAPES
Copper graphic shape opacity/visibility (color ignored).
Definition: layer_ids.h:312
@ 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_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:351
@ 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
LSET allCuMask(int aCuLayerCount)
Definition: lset.cpp:571
LSET allNonCuMask()
Definition: lset.cpp:599
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:744
This file contains miscellaneous commonly used macros and functions.