From 42215f23886e202c84879c3ca1b79dc97cd4821a Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 4 Jun 2015 14:54:07 +0200 Subject: [PATCH] Moved GetLayerSet() to BOARD_ITEM. --- include/class_board_item.h | 10 +++++++++- pcbnew/class_board.cpp | 9 ++++----- pcbnew/class_board.h | 2 +- pcbnew/class_track.cpp | 6 ------ pcbnew/class_track.h | 8 -------- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/include/class_board_item.h b/include/class_board_item.h index 1733418091..7b202ffadd 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -125,10 +125,18 @@ public: /** * Function GetLayer - * returns the layer this item is on. + * returns the primary layer this item is on. */ LAYER_ID GetLayer() const { return m_Layer; } + /** + * Function GetLayerSet + * returns a "layer mask", which is a bitmap of all layers on which the + * TRACK segment or VIA physically resides. + * @return int - a layer mask, see layers_id_colors_visibility.h. + */ + virtual LSET GetLayerSet() const { return LSET( m_Layer ); } + /** * Function SetLayer * sets the layer this item is on. diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index d100df0ced..d137f68d44 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -317,23 +317,22 @@ bool BOARD::SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer ) #include -const LAYER_ID BOARD::GetLayerID(wxString aLayerName) const +const LAYER_ID BOARD::GetLayerID( const wxString& aLayerName ) const { // Look for the BOARD specific copper layer names for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) { - if ( IsCopperLayer( layer ) && - ( m_Layer[ layer ].m_name == aLayerName) ) + if ( IsCopperLayer( layer ) && ( m_Layer[ layer ].m_name == aLayerName ) ) { return ToLAYER_ID( layer ); } } // Otherwise fall back to the system standard layer names - for ( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) + for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer ) { - if ( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName ) + if( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName ) { return ToLAYER_ID( layer ); } diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 1f7fab1647..97f93602c7 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -641,7 +641,7 @@ public: * @return LAYER_ID - the layer id, which for copper layers may * be custom, else standard. */ - const LAYER_ID GetLayerID( wxString aLayerName ) const; + const LAYER_ID GetLayerID( const wxString& aLayerName ) const; /** * Function GetLayerName diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 02281b8ce8..395e679428 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -403,12 +403,6 @@ LSET VIA::GetLayerSet() const } -LSET TRACK::GetLayerSet() const -{ - return LSET( m_Layer ); -} - - void VIA::SetLayerPair( LAYER_ID aTopLayer, LAYER_ID aBottomLayer ) { if( GetViaType() == VIA_THROUGH ) diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 8347deedde..f2e66ae67b 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -182,14 +182,6 @@ public: int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor ) const; - /** - * Function GetLayerMask - * returns a "layer mask", which is a bitmap of all layers on which the - * TRACK segment or VIA physically resides. - * @return int - a layer mask, see pcbstruct.h's LAYER_BACK, etc. - */ - virtual LSET GetLayerSet() const; - /** * Function IsPointOnEnds * returns STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if