From adf4f83cb0ba6840b2e2bc65b99ed572f88728fc Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 30 Jun 2017 13:40:20 +0200 Subject: [PATCH] Code formatting and clean-up --- pcbnew/class_board.cpp | 14 +++++++------- pcbnew/connectivity.cpp | 7 +++---- pcbnew/connectivity.h | 10 ++++------ pcbnew/connectivity_algo.h | 4 ++-- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 078ffba2f6..d3e700d2b3 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -2889,6 +2889,7 @@ extern bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, wxString* aErrorText ); + bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, wxString* aErrorText ) { @@ -2901,10 +2902,6 @@ bool BOARD::GetBoardPolygonOutlines( SHAPE_POLY_SET& aOutlines, } -/*RN_DATA* BOARD::GetRatsnest() const -{ - return m_connectivity->GetRatsnest(); -}*/ const std::vector BOARD::GetPads() { @@ -2919,11 +2916,13 @@ const std::vector BOARD::GetPads() return rv; } + unsigned BOARD::GetPadCount() const { return m_connectivity->GetPadCount(); } + /** * Function GetPad * @return D_PAD* - at the \a aIndex @@ -2931,11 +2930,12 @@ unsigned BOARD::GetPadCount() const D_PAD* BOARD::GetPad( unsigned aIndex ) const { unsigned count = 0; - for ( MODULE *mod = m_Modules; mod ; mod = mod->Next() ) // FIXME: const DLIST_ITERATOR + + for( MODULE* mod = m_Modules; mod ; mod = mod->Next() ) // FIXME: const DLIST_ITERATOR { - for ( D_PAD *pad = mod->PadsList(); pad; pad = pad->Next() ) + for( D_PAD* pad = mod->PadsList(); pad; pad = pad->Next() ) { - if ( count == aIndex ) + if( count == aIndex ) return pad; count++; diff --git a/pcbnew/connectivity.cpp b/pcbnew/connectivity.cpp index 365f642c6f..aa093179d2 100644 --- a/pcbnew/connectivity.cpp +++ b/pcbnew/connectivity.cpp @@ -150,14 +150,13 @@ void CONNECTIVITY_DATA::RecalculateRatsnest() int dirtyNets = 0; for( int net = 0; net < lastNet; net++ ) + { if( m_connAlgo->IsNetDirty( net ) ) { m_nets[net]->Clear(); dirtyNets++; } - - - + } for( auto c : clusters ) { @@ -431,7 +430,7 @@ unsigned int CONNECTIVITY_DATA::GetNodeCount( int aNet ) const { int sum = 0; - if( aNet < 0 ) + if( aNet < 0 ) // Node count for all nets { for( const auto& net : m_nets ) sum += net->GetNodeCount(); diff --git a/pcbnew/connectivity.h b/pcbnew/connectivity.h index 0a5f2346cf..803a3b871c 100644 --- a/pcbnew/connectivity.h +++ b/pcbnew/connectivity.h @@ -35,7 +35,6 @@ #include -class CN_ITEM; class CN_CLUSTER; class CN_CONNECTIVITY_ALGO; class CN_EDGE; @@ -51,7 +50,7 @@ class D_PAD; struct CN_DISJOINT_NET_ENTRY { int net; - BOARD_CONNECTED_ITEM* a, * b; + BOARD_CONNECTED_ITEM *a, *b; VECTOR2I anchorA, anchorB; }; @@ -109,7 +108,6 @@ public: * Function Clear() * Erases the connectivity database. */ - void Clear(); /** @@ -123,7 +121,7 @@ public: * Returns the ratsnest, expressed as a set of graph edges for a given net. */ RN_NET* GetRatsnestForNet( int aNet ); - + /** * Function PropagateNets() * Propagates the net codes from the source pads to the tracks/vias. @@ -156,9 +154,9 @@ public: unsigned int GetPadCount( int aNet = -1 ) const; - const std::vector GetConnectedTracks( const BOARD_CONNECTED_ITEM* aItem ) const; + const std::vector GetConnectedTracks( const BOARD_CONNECTED_ITEM* aItem ) const; - const std::vector GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem ) const; + const std::vector GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem ) const; const std::vector GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aAnchor, KICAD_T aTypes[] ); diff --git a/pcbnew/connectivity_algo.h b/pcbnew/connectivity_algo.h index a2a526803a..31f4d83bce 100644 --- a/pcbnew/connectivity_algo.h +++ b/pcbnew/connectivity_algo.h @@ -883,8 +883,8 @@ public: CN_PAD_LIST& PadList() { return m_padList; } - void ForEachAnchor( std::function aFunc ); - void ForEachItem( std::function aFunc ); + void ForEachAnchor( std::function aFunc ); + void ForEachItem( std::function aFunc ); }; bool operator<( const CN_ANCHOR_PTR a, const CN_ANCHOR_PTR b );