pcbnew: Minor changes in CONNECTIVITY_DATA interface:

- renamed connectivity.[h|cpp] to connectivity_data [.h|.cpp] so that the file name matches the main class name.
- GetNetItems() now returns a vector instead of a list
This commit is contained in:
Tomasz Włostowski 2017-11-15 18:33:06 +01:00
parent 41a9007b6d
commit 00ad8f24a0
36 changed files with 45 additions and 46 deletions

View File

@ -390,7 +390,7 @@ set( PCB_COMMON_SRCS
../pcbnew/class_zone.cpp ../pcbnew/class_zone.cpp
../pcbnew/class_zone_settings.cpp ../pcbnew/class_zone_settings.cpp
../pcbnew/classpcb.cpp ../pcbnew/classpcb.cpp
../pcbnew/connectivity.cpp ../pcbnew/connectivity_data.cpp
../pcbnew/connectivity_algo.cpp ../pcbnew/connectivity_algo.cpp
../pcbnew/convert_drawsegment_list_to_polygon.cpp ../pcbnew/convert_drawsegment_list_to_polygon.cpp
../pcbnew/ratsnest_data.cpp ../pcbnew/ratsnest_data.cpp

View File

@ -50,7 +50,7 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <protos.h> #include <protos.h>
#include <connectivity.h> #include <connectivity_data.h>
#define BLOCK_OUTLINE_COLOR YELLOW #define BLOCK_OUTLINE_COLOR YELLOW

View File

@ -30,7 +30,7 @@
#include <view/view.h> #include <view/view.h>
#include <board_commit.h> #include <board_commit.h>
#include <tools/pcb_tool.h> #include <tools/pcb_tool.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <functional> #include <functional>
using namespace std::placeholders; using namespace std::placeholders;

View File

@ -41,7 +41,7 @@
#include <class_zone.h> #include <class_zone.h>
#include <pcb_netlist.h> #include <pcb_netlist.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <reporter.h> #include <reporter.h>
#include <board_netlist_updater.h> #include <board_netlist_updater.h>

View File

@ -58,7 +58,7 @@
#include <class_pcb_text.h> #include <class_pcb_text.h>
#include <class_pcb_target.h> #include <class_pcb_target.h>
#include <class_dimension.h> #include <class_dimension.h>
#include <connectivity.h> #include <connectivity_data.h>
/* This is an odd place for this, but CvPcb won't link if it is /* This is an odd place for this, but CvPcb won't link if it is

View File

@ -34,7 +34,7 @@
#include <class_board.h> #include <class_board.h>
#include <class_board_item.h> #include <class_board_item.h>
#include <connectivity.h> #include <connectivity_data.h>
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED_ITEM ) BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED_ITEM )

View File

@ -37,7 +37,7 @@
#include <class_track.h> #include <class_track.h>
#include <dialog_cleaning_options.h> #include <dialog_cleaning_options.h>
#include <board_commit.h> #include <board_commit.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <connectivity_algo.h> #include <connectivity_algo.h>
// Helper class used to clean tracks and vias // Helper class used to clean tracks and vias

View File

@ -43,7 +43,7 @@
#include <deque> #include <deque>
#include <intrusive_list.h> #include <intrusive_list.h>
#include <connectivity.h> #include <connectivity_data.h>
class CN_ITEM; class CN_ITEM;
class CN_CONNECTIVITY_ALGO_IMPL; class CN_CONNECTIVITY_ALGO_IMPL;

View File

@ -25,7 +25,7 @@
#include <profile.h> #include <profile.h>
#endif #endif
#include <connectivity.h> #include <connectivity_data.h>
#include <connectivity_algo.h> #include <connectivity_algo.h>
#include <ratsnest_data.h> #include <ratsnest_data.h>
@ -324,11 +324,11 @@ void CONNECTIVITY_DATA::Clear()
} }
const std::list<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems( const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
const BOARD_CONNECTED_ITEM* aItem, const BOARD_CONNECTED_ITEM* aItem,
const KICAD_T aTypes[] ) const const KICAD_T aTypes[] ) const
{ {
std::list<BOARD_CONNECTED_ITEM*> rv; std::vector<BOARD_CONNECTED_ITEM*> rv;
const auto clusters = m_connAlgo->SearchClusters( CN_CONNECTIVITY_ALGO::CSM_CONNECTIVITY_CHECK, const auto clusters = m_connAlgo->SearchClusters( CN_CONNECTIVITY_ALGO::CSM_CONNECTIVITY_CHECK,
aTypes, aItem->GetNetCode() ); aTypes, aItem->GetNetCode() );
@ -348,11 +348,11 @@ const std::list<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetConnectedItems(
} }
const std::list<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetNetItems( int aNetCode, const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetNetItems( int aNetCode,
const KICAD_T aTypes[] ) const const KICAD_T aTypes[] ) const
{ {
std::set<BOARD_CONNECTED_ITEM*> items; std::set<BOARD_CONNECTED_ITEM*> items;
std::list<BOARD_CONNECTED_ITEM*> rv; std::vector<BOARD_CONNECTED_ITEM*> rv;
m_connAlgo->ForEachItem( [&items, aNetCode, &aTypes] ( CN_ITEM* aItem ) m_connAlgo->ForEachItem( [&items, aNetCode, &aTypes] ( CN_ITEM* aItem )
{ {
@ -373,7 +373,7 @@ const std::list<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetNetItems( int aNetC
} }
} ); } );
std::copy( items.begin(), items.end(), std::front_inserter( rv ) ); std::copy( items.begin(), items.end(), std::back_inserter( rv ) );
return rv; return rv;
} }

View File

@ -23,14 +23,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef __CONNECTIVITY_H #ifndef __CONNECTIVITY_DATA_H
#define __CONNECTIVITY_H #define __CONNECTIVITY_DATA_H
#include <core/typeinfo.h> #include <core/typeinfo.h>
#include <wx/string.h> #include <wx/string.h>
#include <vector> #include <vector>
#include <list>
#include <memory> #include <memory>
#include <math/vector2d.h> #include <math/vector2d.h>
@ -192,7 +191,7 @@ public:
* @param aItem is the reference item to find other connected items. * @param aItem is the reference item to find other connected items.
* @param aTypes allows to filter by item types. * @param aTypes allows to filter by item types.
*/ */
const std::list<BOARD_CONNECTED_ITEM*> GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem, const std::vector<BOARD_CONNECTED_ITEM*> GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem,
const KICAD_T aTypes[] ) const; const KICAD_T aTypes[] ) const;
/** /**
@ -201,7 +200,7 @@ public:
* @param aNetCode is the net code. * @param aNetCode is the net code.
* @param aTypes allows to filter by item types. * @param aTypes allows to filter by item types.
*/ */
const std::list<BOARD_CONNECTED_ITEM*> GetNetItems( int aNetCode, const std::vector<BOARD_CONNECTED_ITEM*> GetNetItems( int aNetCode,
const KICAD_T aTypes[] ) const; const KICAD_T aTypes[] ) const;
const std::vector<VECTOR2I> NearestUnconnectedTargets( const BOARD_CONNECTED_ITEM* aRef, const std::vector<VECTOR2I> NearestUnconnectedTargets( const BOARD_CONNECTED_ITEM* aRef,

View File

@ -33,7 +33,7 @@
#include <confirm.h> #include <confirm.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <macros.h> #include <macros.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <class_board.h> #include <class_board.h>
#include <class_track.h> #include <class_track.h>

View File

@ -42,7 +42,7 @@
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <dialog_netlist.h> #include <dialog_netlist.h>

View File

@ -42,7 +42,7 @@
#include <view/view.h> #include <view/view.h>
#include <view/view_controls.h> #include <view/view_controls.h>
#include <pcb_painter.h> #include <pcb_painter.h>
#include <connectivity.h> #include <connectivity_data.h>
#define COL_NETNAME 0 #define COL_NETNAME 0
#define COL_NETINFO 1 #define COL_NETINFO 1

View File

@ -41,7 +41,7 @@
#include <class_module.h> #include <class_module.h>
#include <class_board.h> #include <class_board.h>
#include <connectivity.h> #include <connectivity_data.h>
/* a list of DRAG_SEGM_PICKER items used to move or drag tracks */ /* a list of DRAG_SEGM_PICKER items used to move or drag tracks */
std::vector<DRAG_SEGM_PICKER> g_DragSegmentList; std::vector<DRAG_SEGM_PICKER> g_DragSegmentList;

View File

@ -42,7 +42,7 @@
#include <view/view.h> #include <view/view.h>
#include <geometry/seg.h> #include <geometry/seg.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <connectivity_algo.h> #include <connectivity_algo.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>

View File

@ -54,7 +54,7 @@
#include <dialog_global_edit_tracks_and_vias.h> #include <dialog_global_edit_tracks_and_vias.h>
#include <invoke_pcb_dialog.h> #include <invoke_pcb_dialog.h>
#include <array_creator.h> #include <array_creator.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <dialog_move_exact.h> #include <dialog_move_exact.h>

View File

@ -40,7 +40,7 @@
#include <class_board.h> #include <class_board.h>
#include <class_track.h> #include <class_track.h>
#include <class_zone.h> #include <class_zone.h>
#include <connectivity.h> #include <connectivity_data.h>
static void Abort_Create_Track( EDA_DRAW_PANEL* panel, wxDC* DC ); static void Abort_Create_Track( EDA_DRAW_PANEL* panel, wxDC* DC );

View File

@ -49,7 +49,7 @@
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include <boost/ptr_container/ptr_map.hpp> #include <boost/ptr_container/ptr_map.hpp>
#include <memory.h> #include <memory.h>
#include <connectivity.h> #include <connectivity_data.h>
using namespace PCB_KEYS_T; using namespace PCB_KEYS_T;

View File

@ -43,7 +43,7 @@
#include <drag.h> #include <drag.h>
#include <dialog_get_footprint_by_name.h> #include <dialog_get_footprint_by_name.h>
#include <connectivity.h> #include <connectivity_data.h>
static void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, static void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase ); const wxPoint& aPosition, bool aErase );

View File

@ -29,7 +29,7 @@
#include <worksheet_viewitem.h> #include <worksheet_viewitem.h>
#include <ratsnest_viewitem.h> #include <ratsnest_viewitem.h>
#include <ratsnest_data.h> #include <ratsnest_data.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <class_colors_design_settings.h> #include <class_colors_design_settings.h>
#include <class_board.h> #include <class_board.h>

View File

@ -65,7 +65,7 @@
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <worksheet_viewitem.h> #include <worksheet_viewitem.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <ratsnest_viewitem.h> #include <ratsnest_viewitem.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>

View File

@ -40,7 +40,7 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <ratsnest_data.h> #include <ratsnest_data.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>

View File

@ -29,7 +29,7 @@
#include <ratsnest_viewitem.h> #include <ratsnest_viewitem.h>
#include <ratsnest_data.h> #include <ratsnest_data.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <pcb_painter.h> #include <pcb_painter.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>

View File

@ -44,7 +44,7 @@
#include <class_track.h> #include <class_track.h>
#include <class_zone.h> #include <class_zone.h>
#include <class_drawsegment.h> #include <class_drawsegment.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <view/view.h> #include <view/view.h>
#include <specctra.h> #include <specctra.h>

View File

@ -42,7 +42,7 @@
#include <view/view_controls.h> #include <view/view_controls.h>
#include <view/view.h> #include <view/view.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <confirm.h> #include <confirm.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <hotkeys.h> #include <hotkeys.h>

View File

@ -42,7 +42,7 @@
#include <pcb_draw_panel_gal.h> #include <pcb_draw_panel_gal.h>
#include <class_module.h> #include <class_module.h>
#include <class_pcb_target.h> #include <class_pcb_target.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <collectors.h> #include <collectors.h>
#include <zones_functions_for_undo_redo.h> #include <zones_functions_for_undo_redo.h>
#include <board_commit.h> #include <board_commit.h>

View File

@ -48,7 +48,7 @@
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <pcb_draw_panel_gal.h> #include <pcb_draw_panel_gal.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <view/view_controls.h> #include <view/view_controls.h>

View File

@ -43,7 +43,7 @@ using namespace std::placeholders;
#include <class_zone.h> #include <class_zone.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <connectivity.h> #include <connectivity_data.h>
// Point editor // Point editor
TOOL_ACTION PCB_ACTIONS::pointEditorAddCorner( "pcbnew.PointEditor.addCorner", TOOL_ACTION PCB_ACTIONS::pointEditorAddCorner( "pcbnew.PointEditor.addCorner",

View File

@ -49,7 +49,7 @@ using namespace std::placeholders;
#include <tool/tool_event.h> #include <tool/tool_event.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <connectivity.h> #include <connectivity_data.h>
#include "selection_tool.h" #include "selection_tool.h"
#include "pcb_bright_box.h" #include "pcb_bright_box.h"

View File

@ -52,7 +52,7 @@ using namespace std::placeholders;
#include <tool/tool_event.h> #include <tool/tool_event.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <connectivity.h> #include <connectivity_data.h>
#include "selection_tool.h" #include "selection_tool.h"
#include "pcb_bright_box.h" #include "pcb_bright_box.h"
@ -870,7 +870,7 @@ void SELECTION_TOOL::selectAllItemsConnectedToItem( BOARD_CONNECTED_ITEM& aSourc
constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT }; constexpr KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, EOT };
auto connectivity = board()->GetConnectivity(); auto connectivity = board()->GetConnectivity();
std::list<BOARD_CONNECTED_ITEM*> items; std::vector<BOARD_CONNECTED_ITEM*> items;
items = connectivity->GetConnectedItems( &aSourceItem, types ); items = connectivity->GetConnectedItems( &aSourceItem, types );
for( auto item : connectivity->GetConnectedItems( &aSourceItem, types ) ) for( auto item : connectivity->GetConnectedItems( &aSourceItem, types ) )

View File

@ -40,7 +40,7 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <protos.h> #include <protos.h>
#include <connectivity.h> #include <connectivity_data.h>
static void ListSetState( EDA_ITEM* Start, int NbItem, STATUS_FLAGS State, static void ListSetState( EDA_ITEM* Start, int NbItem, STATUS_FLAGS State,
bool onoff ); bool onoff );

View File

@ -45,7 +45,7 @@ using namespace std::placeholders;
#include <class_zone.h> #include <class_zone.h>
#include <class_edge_mod.h> #include <class_edge_mod.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <tools/selection_tool.h> #include <tools/selection_tool.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>

View File

@ -45,7 +45,7 @@
#include <protos.h> #include <protos.h>
#include <zones_functions_for_undo_redo.h> #include <zones_functions_for_undo_redo.h>
#include <drc_stuff.h> #include <drc_stuff.h>
#include <connectivity.h> #include <connectivity_data.h>
// Outline creation: // Outline creation:
static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC );

View File

@ -43,7 +43,7 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <zones.h> #include <zones.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <board_commit.h> #include <board_commit.h>
#define FORMAT_STRING _( "Filling zone %d out of %d (net %s)..." ) #define FORMAT_STRING _( "Filling zone %d out of %d (net %s)..." )

View File

@ -27,7 +27,7 @@
#include <class_board.h> #include <class_board.h>
#include <class_zone.h> #include <class_zone.h>
#include <connectivity.h> #include <connectivity_data.h>
void ZONE_CONTAINER::TestForCopperIslandAndRemoveInsulatedIslands( BOARD* aPcb ) void ZONE_CONTAINER::TestForCopperIslandAndRemoveInsulatedIslands( BOARD* aPcb )
{ {

View File

@ -46,7 +46,7 @@
#include <pcb_painter.h> #include <pcb_painter.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <connectivity.h> #include <connectivity_data.h>
#include <io_mgr.h> #include <io_mgr.h>
#include <set> #include <set>