1 /* 2 * KiRouter - a push-and-(sometimes-)shove PCB router 3 * 4 * Copyright (C) 2014 CERN 5 * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. 6 * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> 7 * 8 * This program is free software: you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License as published by the 10 * Free Software Foundation, either version 3 of the License, or (at your 11 * option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License along 19 * with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 #include <board.h> 23 24 #include "pns_item.h" 25 #include "pns_sizes_settings.h" 26 27 namespace PNS { 28 29 ClearLayerPairs()30void SIZES_SETTINGS::ClearLayerPairs() 31 { 32 m_layerPairs.clear(); 33 } 34 35 AddLayerPair(int aL1,int aL2)36void SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 ) 37 { 38 int top = std::min( aL1, aL2 ); 39 int bottom = std::max( aL1, aL2 ); 40 41 m_layerPairs[bottom] = top; 42 m_layerPairs[top] = bottom; 43 } 44 45 GetLayerTop() const46int SIZES_SETTINGS::GetLayerTop() const 47 { 48 if( m_layerPairs.empty() ) 49 return F_Cu; 50 else 51 return m_layerPairs.begin()->first; 52 } 53 54 GetLayerBottom() const55int SIZES_SETTINGS::GetLayerBottom() const 56 { 57 if( m_layerPairs.empty() ) 58 return B_Cu; 59 else 60 return m_layerPairs.begin()->second; 61 } 62 63 } 64