From b2c11207e4a9b2be95a8f2ad6888fe270aa0ee21 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 13 Dec 2011 21:28:25 +0100 Subject: [PATCH] pcbnew/class_track.h: remove duplicate class members. --- pcbnew/class_board_connected_item.h | 3 ++- pcbnew/class_track.h | 2 -- pcbnew/connect.cpp | 25 +++++++++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pcbnew/class_board_connected_item.h b/pcbnew/class_board_connected_item.h index e711b09e3b..e459ace0d2 100644 --- a/pcbnew/class_board_connected_item.h +++ b/pcbnew/class_board_connected_item.h @@ -24,11 +24,12 @@ class BOARD_CONNECTED_ITEM : public BOARD_ITEM { friend class CONNECTIONS; -private: +public: // These 2 members are used for temporary storage during connections calculations: std::vector m_TracksConnected; // list of other tracks connected to me std::vector m_PadsConnected; // list of other pads connected to me +private: int m_NetCode; // Net number int m_Subnet; /* In rastnest routines : for the current net, block number diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 3d807af709..0e95f4517f 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -64,8 +64,6 @@ protected: public: BOARD_CONNECTED_ITEM* start; // pointers to a connected item (pad or track) BOARD_CONNECTED_ITEM* end; - std::vector m_TracksConnected; // list of other tracks connected to me - std::vector m_PadsConnected; // list of pads connected to me int m_Param; // Auxiliary variable ( used in some computations ) diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index 7c9fc5a792..157502db2e 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -89,6 +89,11 @@ public: */ void BuildPadsList( int aNetcode = -1 ); + /** + * @return the pads list used in connections calculations + */ + std::vector& GetPadsList() { return m_sortedPads; } + /** * Function Build_CurrNet_SubNets_Connections * Connections to pads are assumed to be already initialized, @@ -106,13 +111,13 @@ public: void Build_CurrNet_SubNets_Connections( TRACK* aFirstTrack, TRACK* aLastTrack ); /** - * Function BuildCandidatesList + * Function BuildTracksCandidatesList * Fills m_Candidates with all connecting points (track ends or via location) * with tracks from aBegin to aEnd. * if aBegin == NULL, use first track in brd list * if aEnd == NULL, uses all tracks from aBegin in brd list */ - void BuildCandidatesList( TRACK * aBegin = NULL, TRACK * aEnd = NULL); + void BuildTracksCandidatesList( TRACK * aBegin = NULL, TRACK * aEnd = NULL); /** * function SearchConnectedTracks @@ -134,15 +139,15 @@ public: } /** - * function SearchConnectedToPads + * function SearchTracksConnectedToPads * Explores the list of pads and adds to m_PadsConnected member * of each track connected the pad(s) connected to */ - void SearchConnectedToPads(); + void SearchTracksConnectedToPads(); /** * function CollectItemsNearTo - * Used by SearchConnectedToPads + * Used by SearchTracksConnectedToPads * Fills aList with pads near to aPosition * near means aPosition to pad position <= aDistMax * @param aList = list to fill @@ -232,7 +237,7 @@ void CONNECTIONS::BuildPadsList( int aNetcode ) } -void CONNECTIONS::SearchConnectedToPads() +void CONNECTIONS::SearchTracksConnectedToPads() { std::vector candidates; @@ -345,7 +350,7 @@ static bool sortConnectedPointByXthenYCoordinates( const CONNECTED_POINT & aRef, return aRef.GetPoint().x < aTst.GetPoint().x; } -void CONNECTIONS::BuildCandidatesList( TRACK * aBegin, TRACK * aEnd) +void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd) { m_candidates.clear(); @@ -505,7 +510,7 @@ void CONNECTIONS::Build_CurrNet_SubNets_Connections( TRACK* aFirstTrack, TRACK* // Pads subnets are expected already cleared, because this function // does not know the full list of pads - BuildCandidatesList( aFirstTrack, aLastTrack ); + BuildTracksCandidatesList( aFirstTrack, aLastTrack ); for( curr_track = aFirstTrack; curr_track != NULL; curr_track = curr_track->Next() ) { // Clear track subnet id (Pads subnets are cleared outside this function) @@ -807,10 +812,10 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode() CONNECTIONS connections( m_Pcb ); connections.BuildPadsList(); - connections.BuildCandidatesList(); + connections.BuildTracksCandidatesList(); // First pass: build connections between track segments and pads. - connections.SearchConnectedToPads(); + connections.SearchTracksConnectedToPads(); /* For tracks connected to at least one pad, * set the track net code to the pad netcode