You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

801 lines
18 KiB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
  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 <dick@softplc.com>
  5. * Copyright (C) 2014-2017 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. #include <stdarg.h>
  25. #include <assert.h>
  26. #include <layers_id_colors_and_visibility.h>
  27. #include <class_board.h>
  28. LSET::LSET( const PCB_LAYER_ID* aArray, unsigned aCount ) :
  29. BASE_SET()
  30. {
  31. for( unsigned i=0; i<aCount; ++i )
  32. set( aArray[i] );
  33. }
  34. LSET::LSET( unsigned aIdCount, int aFirst, ... ) :
  35. BASE_SET()
  36. {
  37. // The constructor, without the mandatory aFirst argument, could have been confused
  38. // by the compiler with the LSET( PCB_LAYER_ID ). With aFirst, that ambiguity is not
  39. // present. Therefore aIdCount must always be >=1.
  40. wxASSERT_MSG( aIdCount > 0, wxT( "aIdCount must be >= 1" ) );
  41. set( aFirst );
  42. if( --aIdCount )
  43. {
  44. va_list ap;
  45. va_start( ap, aFirst );
  46. for( unsigned i=0; i<aIdCount; ++i )
  47. {
  48. PCB_LAYER_ID id = (PCB_LAYER_ID) va_arg( ap, int );
  49. // printf( "%s: id:%d PCB_LAYER_ID_COUNT:%d\n", __func__, id, PCB_LAYER_ID_COUNT );
  50. assert( unsigned( id ) < PCB_LAYER_ID_COUNT );
  51. set( id );
  52. }
  53. va_end( ap );
  54. }
  55. }
  56. const wxChar* LSET::Name( PCB_LAYER_ID aLayerId )
  57. {
  58. const wxChar* txt;
  59. // using a switch to explicitly show the mapping more clearly
  60. switch( aLayerId )
  61. {
  62. case F_Cu: txt = wxT( "F.Cu" ); break;
  63. case In1_Cu: txt = wxT( "In1.Cu" ); break;
  64. case In2_Cu: txt = wxT( "In2.Cu" ); break;
  65. case In3_Cu: txt = wxT( "In3.Cu" ); break;
  66. case In4_Cu: txt = wxT( "In4.Cu" ); break;
  67. case In5_Cu: txt = wxT( "In5.Cu" ); break;
  68. case In6_Cu: txt = wxT( "In6.Cu" ); break;
  69. case In7_Cu: txt = wxT( "In7.Cu" ); break;
  70. case In8_Cu: txt = wxT( "In8.Cu" ); break;
  71. case In9_Cu: txt = wxT( "In9.Cu" ); break;
  72. case In10_Cu: txt = wxT( "In10.Cu" ); break;
  73. case In11_Cu: txt = wxT( "In11.Cu" ); break;
  74. case In12_Cu: txt = wxT( "In12.Cu" ); break;
  75. case In13_Cu: txt = wxT( "In13.Cu" ); break;
  76. case In14_Cu: txt = wxT( "In14.Cu" ); break;
  77. case In15_Cu: txt = wxT( "In15.Cu" ); break;
  78. case In16_Cu: txt = wxT( "In16.Cu" ); break;
  79. case In17_Cu: txt = wxT( "In17.Cu" ); break;
  80. case In18_Cu: txt = wxT( "In18.Cu" ); break;
  81. case In19_Cu: txt = wxT( "In19.Cu" ); break;
  82. case In20_Cu: txt = wxT( "In20.Cu" ); break;
  83. case In21_Cu: txt = wxT( "In21.Cu" ); break;
  84. case In22_Cu: txt = wxT( "In22.Cu" ); break;
  85. case In23_Cu: txt = wxT( "In23.Cu" ); break;
  86. case In24_Cu: txt = wxT( "In24.Cu" ); break;
  87. case In25_Cu: txt = wxT( "In25.Cu" ); break;
  88. case In26_Cu: txt = wxT( "In26.Cu" ); break;
  89. case In27_Cu: txt = wxT( "In27.Cu" ); break;
  90. case In28_Cu: txt = wxT( "In28.Cu" ); break;
  91. case In29_Cu: txt = wxT( "In29.Cu" ); break;
  92. case In30_Cu: txt = wxT( "In30.Cu" ); break;
  93. case B_Cu: txt = wxT( "B.Cu" ); break;
  94. // Technicals
  95. case B_Adhes: txt = wxT( "B.Adhes" ); break;
  96. case F_Adhes: txt = wxT( "F.Adhes" ); break;
  97. case B_Paste: txt = wxT( "B.Paste" ); break;
  98. case F_Paste: txt = wxT( "F.Paste" ); break;
  99. case B_SilkS: txt = wxT( "B.SilkS" ); break;
  100. case F_SilkS: txt = wxT( "F.SilkS" ); break;
  101. case B_Mask: txt = wxT( "B.Mask" ); break;
  102. case F_Mask: txt = wxT( "F.Mask" ); break;
  103. // Users
  104. case Dwgs_User: txt = wxT( "Dwgs.User" ); break;
  105. case Cmts_User: txt = wxT( "Cmts.User" ); break;
  106. case Eco1_User: txt = wxT( "Eco1.User" ); break;
  107. case Eco2_User: txt = wxT( "Eco2.User" ); break;
  108. case Edge_Cuts: txt = wxT( "Edge.Cuts" ); break;
  109. case Margin: txt = wxT( "Margin" ); break;
  110. // Footprint
  111. case F_CrtYd: txt = wxT( "F.CrtYd" ); break;
  112. case B_CrtYd: txt = wxT( "B.CrtYd" ); break;
  113. case F_Fab: txt = wxT( "F.Fab" ); break;
  114. case B_Fab: txt = wxT( "B.Fab" ); break;
  115. default:
  116. std::cout << aLayerId << std::endl;
  117. wxASSERT_MSG( 0, wxT( "aLayerId out of range" ) );
  118. txt = wxT( "BAD INDEX!" ); break;
  119. }
  120. return txt;
  121. }
  122. LSEQ LSET::CuStack() const
  123. {
  124. // desired sequence
  125. static const PCB_LAYER_ID sequence[] = {
  126. F_Cu,
  127. In1_Cu,
  128. In2_Cu,
  129. In3_Cu,
  130. In4_Cu,
  131. In5_Cu,
  132. In6_Cu,
  133. In7_Cu,
  134. In8_Cu,
  135. In9_Cu,
  136. In10_Cu,
  137. In11_Cu,
  138. In12_Cu,
  139. In13_Cu,
  140. In14_Cu,
  141. In15_Cu,
  142. In16_Cu,
  143. In17_Cu,
  144. In18_Cu,
  145. In19_Cu,
  146. In20_Cu,
  147. In21_Cu,
  148. In22_Cu,
  149. In23_Cu,
  150. In24_Cu,
  151. In25_Cu,
  152. In26_Cu,
  153. In27_Cu,
  154. In28_Cu,
  155. In29_Cu,
  156. In30_Cu,
  157. B_Cu, // 31
  158. };
  159. return Seq( sequence, DIM( sequence ) );
  160. }
  161. LSEQ LSET::Technicals( LSET aSetToOmit ) const
  162. {
  163. // desired sequence
  164. static const PCB_LAYER_ID sequence[] = {
  165. F_Adhes,
  166. B_Adhes,
  167. F_Paste,
  168. B_Paste,
  169. F_SilkS,
  170. B_SilkS,
  171. F_Mask,
  172. B_Mask,
  173. F_CrtYd,
  174. B_CrtYd,
  175. F_Fab,
  176. B_Fab,
  177. };
  178. LSET subset = ~aSetToOmit & *this;
  179. return subset.Seq( sequence, DIM( sequence ) );
  180. }
  181. LSEQ LSET::Users() const
  182. {
  183. // desired
  184. static const PCB_LAYER_ID sequence[] = {
  185. Dwgs_User,
  186. Cmts_User,
  187. Eco1_User,
  188. Eco2_User,
  189. Edge_Cuts,
  190. Margin,
  191. };
  192. return Seq( sequence, DIM( sequence ) );
  193. }
  194. LSEQ LSET::TechAndUserUIOrder() const
  195. {
  196. static const PCB_LAYER_ID sequence[] = {
  197. F_Adhes,
  198. B_Adhes,
  199. F_Paste,
  200. B_Paste,
  201. F_SilkS,
  202. B_SilkS,
  203. F_Mask,
  204. B_Mask,
  205. Dwgs_User,
  206. Cmts_User,
  207. Eco1_User,
  208. Eco2_User,
  209. Edge_Cuts,
  210. Margin,
  211. F_CrtYd,
  212. B_CrtYd,
  213. F_Fab,
  214. B_Fab,
  215. };
  216. return Seq( sequence, DIM( sequence ) );
  217. }
  218. std::string LSET::FmtBin() const
  219. {
  220. std::string ret;
  221. int bit_count = size();
  222. for( int bit=0; bit<bit_count; ++bit )
  223. {
  224. if( bit )
  225. {
  226. if( !( bit % 8 ) )
  227. ret += '|';
  228. else if( !( bit % 4 ) )
  229. ret += '_';
  230. }
  231. ret += (*this)[bit] ? '1' : '0';
  232. }
  233. // reverse of string
  234. return std::string( ret.rbegin(), ret.rend() );
  235. }
  236. std::string LSET::FmtHex() const
  237. {
  238. std::string ret;
  239. static const char hex[] = "0123456789abcdef";
  240. int nibble_count = ( size() + 3 ) / 4;
  241. for( int nibble=0; nibble<nibble_count; ++nibble )
  242. {
  243. unsigned ndx = 0;
  244. // test 4 consecutive bits and set ndx to 0-15:
  245. for( int nibble_bit=0; nibble_bit<4; ++nibble_bit )
  246. {
  247. if( (*this)[nibble_bit + nibble*4] )
  248. ndx |= (1 << nibble_bit);
  249. }
  250. if( nibble && !( nibble % 8 ) )
  251. ret += '_';
  252. assert( ndx < DIM( hex ) );
  253. ret += hex[ndx];
  254. }
  255. // reverse of string
  256. return std::string( ret.rbegin(), ret.rend() );
  257. }
  258. int LSET::ParseHex( const char* aStart, int aCount )
  259. {
  260. LSET tmp;
  261. const char* rstart = aStart + aCount - 1;
  262. const char* rend = aStart - 1;
  263. const int bitcount = size();
  264. int nibble_ndx = 0;
  265. while( rstart > rend )
  266. {
  267. int cc = *rstart--;
  268. if( cc == '_' )
  269. continue;
  270. int nibble;
  271. if( cc >= '0' && cc <= '9' )
  272. nibble = cc - '0';
  273. else if( cc >= 'a' && cc <= 'f' )
  274. nibble = cc - 'a' + 10;
  275. else if( cc >= 'A' && cc <= 'F' )
  276. nibble = cc - 'A' + 10;
  277. else
  278. break;
  279. int bit = nibble_ndx * 4;
  280. for( int ndx=0; bit<bitcount && ndx<4; ++bit, ++ndx )
  281. if( nibble & (1<<ndx) )
  282. tmp.set( bit );
  283. if( bit >= bitcount )
  284. break;
  285. ++nibble_ndx;
  286. }
  287. int byte_count = aStart + aCount - 1 - rstart;
  288. assert( byte_count >= 0 );
  289. if( byte_count > 0 )
  290. *this = tmp;
  291. return byte_count;
  292. }
  293. LSEQ LSET::Seq( const PCB_LAYER_ID* aWishListSequence, unsigned aCount ) const
  294. {
  295. LSEQ ret;
  296. #if defined(DEBUG) && 0
  297. LSET dup_detector;
  298. for( unsigned i=0; i<aCount; ++i )
  299. {
  300. PCB_LAYER_ID id = aWishListSequence[i];
  301. if( test( id ) )
  302. {
  303. wxASSERT_MSG( !dup_detector[id], wxT( "Duplicate in aWishListSequence" ) );
  304. dup_detector[id] = true;
  305. ret.push_back( id );
  306. }
  307. }
  308. #else
  309. for( unsigned i=0; i<aCount; ++i )
  310. {
  311. PCB_LAYER_ID id = aWishListSequence[i];
  312. if( test( id ) )
  313. ret.push_back( id );
  314. }
  315. #endif
  316. return ret;
  317. }
  318. LSEQ LSET::Seq() const
  319. {
  320. LSEQ ret;
  321. for( unsigned i=0; i<size(); ++i )
  322. {
  323. if( test(i) )
  324. ret.push_back( PCB_LAYER_ID( i ) );
  325. }
  326. return ret;
  327. }
  328. LSEQ LSET::SeqStackupBottom2Top() const
  329. {
  330. // bottom-to-top stack-up layers
  331. static const PCB_LAYER_ID sequence[] = {
  332. B_Fab,
  333. B_CrtYd,
  334. B_Adhes,
  335. B_SilkS,
  336. B_Paste,
  337. B_Mask,
  338. B_Cu,
  339. In30_Cu,
  340. In29_Cu,
  341. In28_Cu,
  342. In27_Cu,
  343. In26_Cu,
  344. In25_Cu,
  345. In24_Cu,
  346. In23_Cu,
  347. In22_Cu,
  348. In21_Cu,
  349. In20_Cu,
  350. In19_Cu,
  351. In18_Cu,
  352. In17_Cu,
  353. In16_Cu,
  354. In15_Cu,
  355. In14_Cu,
  356. In13_Cu,
  357. In12_Cu,
  358. In11_Cu,
  359. In10_Cu,
  360. In9_Cu,
  361. In8_Cu,
  362. In7_Cu,
  363. In6_Cu,
  364. In5_Cu,
  365. In4_Cu,
  366. In3_Cu,
  367. In2_Cu,
  368. In1_Cu,
  369. F_Cu,
  370. F_Mask,
  371. F_Paste,
  372. F_SilkS,
  373. F_Adhes,
  374. F_CrtYd,
  375. F_Fab,
  376. Dwgs_User,
  377. Cmts_User,
  378. Eco1_User,
  379. Eco2_User,
  380. Margin,
  381. Edge_Cuts,
  382. };
  383. return Seq( sequence, DIM( sequence ) );
  384. }
  385. PCB_LAYER_ID FlipLayer( PCB_LAYER_ID aLayerId, int aCopperLayersCount )
  386. {
  387. switch( aLayerId )
  388. {
  389. case B_Cu: return F_Cu;
  390. case F_Cu: return B_Cu;
  391. case B_SilkS: return F_SilkS;
  392. case F_SilkS: return B_SilkS;
  393. case B_Adhes: return F_Adhes;
  394. case F_Adhes: return B_Adhes;
  395. case B_Mask: return F_Mask;
  396. case F_Mask: return B_Mask;
  397. case B_Paste: return F_Paste;
  398. case F_Paste: return B_Paste;
  399. case B_CrtYd: return F_CrtYd;
  400. case F_CrtYd: return B_CrtYd;
  401. case B_Fab: return F_Fab;
  402. case F_Fab: return B_Fab;
  403. default: // change internal layer if aCopperLayersCount is >= 4
  404. if( IsCopperLayer( aLayerId ) && aCopperLayersCount >= 4 )
  405. {
  406. // internal copper layers count is aCopperLayersCount-2
  407. PCB_LAYER_ID fliplayer = PCB_LAYER_ID(aCopperLayersCount - 2 - ( aLayerId - In1_Cu ) );
  408. // Ensure fliplayer has a value which does not crash pcbnew:
  409. if( fliplayer < F_Cu )
  410. fliplayer = F_Cu;
  411. if( fliplayer > B_Cu )
  412. fliplayer = B_Cu;
  413. return fliplayer;
  414. }
  415. // No change for the other layers
  416. return aLayerId;
  417. }
  418. }
  419. LSET FlipLayerMask( LSET aMask, int aCopperLayersCount )
  420. {
  421. // layers on physical outside of a board:
  422. const static LSET and_mask( 16, // !! update count
  423. B_Cu, F_Cu,
  424. B_SilkS, F_SilkS,
  425. B_Adhes, F_Adhes,
  426. B_Mask, F_Mask,
  427. B_Paste, F_Paste,
  428. B_Adhes, F_Adhes,
  429. B_CrtYd, F_CrtYd,
  430. B_Fab, F_Fab
  431. );
  432. LSET newMask = aMask & ~and_mask;
  433. if( aMask[B_Cu] )
  434. newMask.set( F_Cu );
  435. if( aMask[F_Cu] )
  436. newMask.set( B_Cu );
  437. if( aMask[B_SilkS] )
  438. newMask.set( F_SilkS );
  439. if( aMask[F_SilkS] )
  440. newMask.set( B_SilkS );
  441. if( aMask[B_Adhes] )
  442. newMask.set( F_Adhes );
  443. if( aMask[F_Adhes] )
  444. newMask.set( B_Adhes );
  445. if( aMask[B_Mask] )
  446. newMask.set( F_Mask );
  447. if( aMask[F_Mask] )
  448. newMask.set( B_Mask );
  449. if( aMask[B_Paste] )
  450. newMask.set( F_Paste );
  451. if( aMask[F_Paste] )
  452. newMask.set( B_Paste );
  453. if( aMask[B_Adhes] )
  454. newMask.set( F_Adhes );
  455. if( aMask[F_Adhes] )
  456. newMask.set( B_Adhes );
  457. if( aMask[B_CrtYd] )
  458. newMask.set( F_CrtYd );
  459. if( aMask[F_CrtYd] )
  460. newMask.set( B_CrtYd );
  461. if( aMask[B_Fab] )
  462. newMask.set( F_Fab );
  463. if( aMask[F_Fab] )
  464. newMask.set( B_Fab );
  465. if( aCopperLayersCount >= 4 ) // Internal layers exist
  466. {
  467. LSET internalMask = aMask & LSET::InternalCuMask();
  468. if( internalMask != LSET::InternalCuMask() )
  469. {
  470. // the mask does not include all internal layers. Therefore
  471. // the flipped mask for internal copper layers must be built
  472. int innerLayerCnt = aCopperLayersCount -2;
  473. // the flipped mask is the innerLayerCnt bits rewritten in reverse order
  474. // ( bits innerLayerCnt to 1 rewritten in bits 1 to innerLayerCnt )
  475. for( int ii = 0; ii < innerLayerCnt; ii++ )
  476. {
  477. if( internalMask[innerLayerCnt - ii] )
  478. {
  479. newMask.set( ii + In1_Cu );
  480. }
  481. else
  482. {
  483. newMask.reset( ii + In1_Cu );
  484. }
  485. }
  486. }
  487. }
  488. return newMask;
  489. }
  490. PCB_LAYER_ID LSET::ExtractLayer() const
  491. {
  492. unsigned set_count = count();
  493. if( !set_count )
  494. return UNSELECTED_LAYER;
  495. else if( set_count > 1 )
  496. return UNDEFINED_LAYER;
  497. for( unsigned i=0; i < size(); ++i )
  498. {
  499. if( test( i ) )
  500. return PCB_LAYER_ID( i );
  501. }
  502. wxASSERT( 0 ); // set_count was verified as 1 above, what did you break?
  503. return UNDEFINED_LAYER;
  504. }
  505. LSET LSET::InternalCuMask()
  506. {
  507. static const PCB_LAYER_ID cu_internals[] = {
  508. In1_Cu,
  509. In2_Cu,
  510. In3_Cu,
  511. In4_Cu,
  512. In5_Cu,
  513. In6_Cu,
  514. In7_Cu,
  515. In8_Cu,
  516. In9_Cu,
  517. In10_Cu,
  518. In11_Cu,
  519. In12_Cu,
  520. In13_Cu,
  521. In14_Cu,
  522. In15_Cu,
  523. In16_Cu,
  524. In17_Cu,
  525. In18_Cu,
  526. In19_Cu,
  527. In20_Cu,
  528. In21_Cu,
  529. In22_Cu,
  530. In23_Cu,
  531. In24_Cu,
  532. In25_Cu,
  533. In26_Cu,
  534. In27_Cu,
  535. In28_Cu,
  536. In29_Cu,
  537. In30_Cu,
  538. };
  539. static const LSET saved( cu_internals, DIM( cu_internals ) );
  540. return saved;
  541. }
  542. LSET LSET::AllCuMask( int aCuLayerCount )
  543. {
  544. // retain all in static as the full set, which is a common case.
  545. static const LSET all = InternalCuMask().set( F_Cu ).set( B_Cu );
  546. if( aCuLayerCount == MAX_CU_LAYERS )
  547. return all;
  548. // subtract out some Cu layers not wanted in the mask.
  549. LSET ret = all;
  550. int clear_count = MAX_CU_LAYERS - aCuLayerCount;
  551. clear_count = Clamp( 0, clear_count, MAX_CU_LAYERS - 2 );
  552. for( LAYER_NUM elem=In30_Cu; clear_count; --elem, --clear_count )
  553. {
  554. ret.set( elem, false );
  555. }
  556. return ret;
  557. }
  558. LSET LSET::AllNonCuMask()
  559. {
  560. static const LSET saved = LSET().set() & ~AllCuMask();
  561. return saved;
  562. }
  563. LSET LSET::ExternalCuMask()
  564. {
  565. static const LSET saved( 2, F_Cu, B_Cu );
  566. return saved;
  567. }
  568. LSET LSET::AllLayersMask()
  569. {
  570. static const LSET saved = LSET().set();
  571. return saved;
  572. }
  573. LSET LSET::BackTechMask()
  574. {
  575. static const LSET saved( 6, B_SilkS, B_Mask, B_Adhes, B_Paste, B_CrtYd, B_Fab );
  576. return saved;
  577. }
  578. LSET LSET::BackBoardTechMask()
  579. {
  580. static const LSET saved( 4, B_SilkS, B_Mask, B_Adhes, B_Paste );
  581. return saved;
  582. }
  583. LSET LSET::FrontTechMask()
  584. {
  585. static const LSET saved( 6, F_SilkS, F_Mask, F_Adhes, F_Paste, F_CrtYd, F_Fab );
  586. return saved;
  587. }
  588. LSET LSET::FrontBoardTechMask()
  589. {
  590. static const LSET saved( 4, F_SilkS, F_Mask, F_Adhes, F_Paste );
  591. return saved;
  592. }
  593. LSET LSET::AllTechMask()
  594. {
  595. static const LSET saved = BackTechMask() | FrontTechMask();
  596. return saved;
  597. }
  598. LSET LSET::AllBoardTechMask()
  599. {
  600. static const LSET saved = BackBoardTechMask() | FrontBoardTechMask();
  601. return saved;
  602. }
  603. LSET LSET::UserMask()
  604. {
  605. static const LSET saved( 6,
  606. Dwgs_User,
  607. Cmts_User,
  608. Eco1_User,
  609. Eco2_User,
  610. Edge_Cuts,
  611. Margin
  612. );
  613. return saved;
  614. }
  615. LSET LSET::FrontMask()
  616. {
  617. static const LSET saved = FrontTechMask().set( F_Cu );
  618. return saved;
  619. }
  620. LSET LSET::BackMask()
  621. {
  622. static const LSET saved = BackTechMask().set( B_Cu );
  623. return saved;
  624. }
  625. LSEQ LSET::UIOrder() const
  626. {
  627. LSEQ order = CuStack();
  628. LSEQ techuser = TechAndUserUIOrder();
  629. order.insert( order.end(), techuser.begin(), techuser.end() );
  630. return order;
  631. }
  632. PCB_LAYER_ID ToLAYER_ID( int aLayer )
  633. {
  634. wxASSERT( unsigned( aLayer ) < PCB_LAYER_ID_COUNT );
  635. return PCB_LAYER_ID( aLayer );
  636. }