From 00ad8f24a0f58f1a80394e21f374270c016cc9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Wed, 15 Nov 2017 18:33:06 +0100 Subject: [PATCH] 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 --- common/CMakeLists.txt | 2 +- pcbnew/block.cpp | 2 +- pcbnew/board_commit.cpp | 2 +- pcbnew/board_netlist_updater.cpp | 2 +- pcbnew/class_board.cpp | 2 +- pcbnew/class_board_connected_item.cpp | 2 +- pcbnew/clean.cpp | 2 +- pcbnew/connectivity_algo.h | 2 +- pcbnew/{connectivity.cpp => connectivity_data.cpp} | 12 ++++++------ pcbnew/{connectivity.h => connectivity_data.h} | 9 ++++----- pcbnew/deltrack.cpp | 2 +- pcbnew/dialogs/dialog_netlist.cpp | 2 +- pcbnew/dialogs/dialog_select_net_from_list.cpp | 2 +- pcbnew/dragsegm.cpp | 2 +- pcbnew/drc.cpp | 2 +- pcbnew/edit.cpp | 2 +- pcbnew/editrack.cpp | 2 +- pcbnew/kicad_plugin.cpp | 2 +- pcbnew/modules.cpp | 2 +- pcbnew/pcb_draw_panel_gal.cpp | 2 +- pcbnew/pcbframe.cpp | 2 +- pcbnew/ratsnest.cpp | 2 +- pcbnew/ratsnest_viewitem.cpp | 2 +- pcbnew/specctra_import.cpp | 2 +- pcbnew/tools/edit_tool.cpp | 2 +- pcbnew/tools/pcb_editor_control.cpp | 2 +- pcbnew/tools/pcbnew_control.cpp | 2 +- pcbnew/tools/point_editor.cpp | 2 +- pcbnew/tools/selection.cpp | 2 +- pcbnew/tools/selection_tool.cpp | 4 ++-- pcbnew/tr_modif.cpp | 2 +- pcbnew/undo_redo.cpp | 2 +- pcbnew/zones_by_polygon.cpp | 2 +- pcbnew/zones_by_polygon_fill_functions.cpp | 2 +- pcbnew/zones_polygons_insulated_copper_islands.cpp | 2 +- qa/common/pcb_test_frame.cpp | 2 +- 36 files changed, 45 insertions(+), 46 deletions(-) rename pcbnew/{connectivity.cpp => connectivity_data.cpp} (97%) rename pcbnew/{connectivity.h => connectivity_data.h} (96%) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 90cadc6058..31b868702c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -390,7 +390,7 @@ set( PCB_COMMON_SRCS ../pcbnew/class_zone.cpp ../pcbnew/class_zone_settings.cpp ../pcbnew/classpcb.cpp - ../pcbnew/connectivity.cpp + ../pcbnew/connectivity_data.cpp ../pcbnew/connectivity_algo.cpp ../pcbnew/convert_drawsegment_list_to_polygon.cpp ../pcbnew/ratsnest_data.cpp diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index ce6f465a7f..b71655e3bd 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -50,7 +50,7 @@ #include #include -#include +#include #define BLOCK_OUTLINE_COLOR YELLOW diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 4a1c878f5b..98da1457c3 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include using namespace std::placeholders; diff --git a/pcbnew/board_netlist_updater.cpp b/pcbnew/board_netlist_updater.cpp index c3b705ae8a..9963025718 100644 --- a/pcbnew/board_netlist_updater.cpp +++ b/pcbnew/board_netlist_updater.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index eb4c9c484a..281f54c2aa 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include /* This is an odd place for this, but CvPcb won't link if it is diff --git a/pcbnew/class_board_connected_item.cpp b/pcbnew/class_board_connected_item.cpp index 146139e2f4..42ddc8d331 100644 --- a/pcbnew/class_board_connected_item.cpp +++ b/pcbnew/class_board_connected_item.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED_ITEM ) diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 5e52049d1c..ea5393aa0d 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include // Helper class used to clean tracks and vias diff --git a/pcbnew/connectivity_algo.h b/pcbnew/connectivity_algo.h index ac2e736388..176c6dd12e 100644 --- a/pcbnew/connectivity_algo.h +++ b/pcbnew/connectivity_algo.h @@ -43,7 +43,7 @@ #include #include -#include +#include class CN_ITEM; class CN_CONNECTIVITY_ALGO_IMPL; diff --git a/pcbnew/connectivity.cpp b/pcbnew/connectivity_data.cpp similarity index 97% rename from pcbnew/connectivity.cpp rename to pcbnew/connectivity_data.cpp index 4a54cdc23b..36902aa235 100644 --- a/pcbnew/connectivity.cpp +++ b/pcbnew/connectivity_data.cpp @@ -25,7 +25,7 @@ #include #endif -#include +#include #include #include @@ -324,11 +324,11 @@ void CONNECTIVITY_DATA::Clear() } -const std::list CONNECTIVITY_DATA::GetConnectedItems( +const std::vector CONNECTIVITY_DATA::GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem, const KICAD_T aTypes[] ) const { - std::list rv; + std::vector rv; const auto clusters = m_connAlgo->SearchClusters( CN_CONNECTIVITY_ALGO::CSM_CONNECTIVITY_CHECK, aTypes, aItem->GetNetCode() ); @@ -348,11 +348,11 @@ const std::list CONNECTIVITY_DATA::GetConnectedItems( } -const std::list CONNECTIVITY_DATA::GetNetItems( int aNetCode, +const std::vector CONNECTIVITY_DATA::GetNetItems( int aNetCode, const KICAD_T aTypes[] ) const { std::set items; - std::list rv; + std::vector rv; m_connAlgo->ForEachItem( [&items, aNetCode, &aTypes] ( CN_ITEM* aItem ) { @@ -373,7 +373,7 @@ const std::list 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; } diff --git a/pcbnew/connectivity.h b/pcbnew/connectivity_data.h similarity index 96% rename from pcbnew/connectivity.h rename to pcbnew/connectivity_data.h index b9df91406a..98d73d5482 100644 --- a/pcbnew/connectivity.h +++ b/pcbnew/connectivity_data.h @@ -23,14 +23,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef __CONNECTIVITY_H -#define __CONNECTIVITY_H +#ifndef __CONNECTIVITY_DATA_H +#define __CONNECTIVITY_DATA_H #include #include #include -#include #include #include @@ -192,7 +191,7 @@ public: * @param aItem is the reference item to find other connected items. * @param aTypes allows to filter by item types. */ - const std::list GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem, + const std::vector GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem, const KICAD_T aTypes[] ) const; /** @@ -201,7 +200,7 @@ public: * @param aNetCode is the net code. * @param aTypes allows to filter by item types. */ - const std::list GetNetItems( int aNetCode, + const std::vector GetNetItems( int aNetCode, const KICAD_T aTypes[] ) const; const std::vector NearestUnconnectedTargets( const BOARD_CONNECTED_ITEM* aRef, diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index cae59375a3..7733755c2e 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index c6f68fd168..73a368a91c 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include diff --git a/pcbnew/dialogs/dialog_select_net_from_list.cpp b/pcbnew/dialogs/dialog_select_net_from_list.cpp index a75847a9ff..ae0e7fb1e5 100644 --- a/pcbnew/dialogs/dialog_select_net_from_list.cpp +++ b/pcbnew/dialogs/dialog_select_net_from_list.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #define COL_NETNAME 0 #define COL_NETINFO 1 diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index 12ea5a931c..8517b6f60d 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include /* a list of DRAG_SEGM_PICKER items used to move or drag tracks */ std::vector g_DragSegmentList; diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 6abcbd0c00..461581afb2 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index eb1b0d1f1d..153d50a800 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 5f158b93b0..1b559bff47 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include static void Abort_Create_Track( EDA_DRAW_PANEL* panel, wxDC* DC ); diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 0abb0806e9..d6a3055711 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include using namespace PCB_KEYS_T; diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 7dd7aca5c7..9c52020064 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include static void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index 629e414ee6..1e970049c7 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 3077519163..4dd1005597 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -65,7 +65,7 @@ #include #include #include -#include +#include #include #include diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 64e4e079f7..cb32ae8523 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -40,7 +40,7 @@ #include -#include +#include #include #include diff --git a/pcbnew/ratsnest_viewitem.cpp b/pcbnew/ratsnest_viewitem.cpp index eeb7224603..b99dbe39bd 100644 --- a/pcbnew/ratsnest_viewitem.cpp +++ b/pcbnew/ratsnest_viewitem.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/pcbnew/specctra_import.cpp b/pcbnew/specctra_import.cpp index 135035d8a6..6220f1eaae 100644 --- a/pcbnew/specctra_import.cpp +++ b/pcbnew/specctra_import.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index bb6fe3f807..2ae7a4d8b1 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 301de97c9e..28c0602987 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index f5ea9690be..970e9016e1 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 59f9544ffb..fa225f508b 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -43,7 +43,7 @@ using namespace std::placeholders; #include #include #include -#include +#include // Point editor TOOL_ACTION PCB_ACTIONS::pointEditorAddCorner( "pcbnew.PointEditor.addCorner", diff --git a/pcbnew/tools/selection.cpp b/pcbnew/tools/selection.cpp index 17cd62ef05..0906a40c74 100644 --- a/pcbnew/tools/selection.cpp +++ b/pcbnew/tools/selection.cpp @@ -49,7 +49,7 @@ using namespace std::placeholders; #include #include -#include +#include #include "selection_tool.h" #include "pcb_bright_box.h" diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 1841bb0db5..5a423ba32a 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -52,7 +52,7 @@ using namespace std::placeholders; #include #include -#include +#include #include "selection_tool.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 }; auto connectivity = board()->GetConnectivity(); - std::list items; + std::vector items; items = connectivity->GetConnectedItems( &aSourceItem, types ); for( auto item : connectivity->GetConnectedItems( &aSourceItem, types ) ) diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 07318493a8..53cda3df9d 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include static void ListSetState( EDA_ITEM* Start, int NbItem, STATUS_FLAGS State, bool onoff ); diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index db17fc66a5..af621cc690 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -45,7 +45,7 @@ using namespace std::placeholders; #include #include -#include +#include #include #include diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 02125591e1..72e3b5552e 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include // Outline creation: static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC ); diff --git a/pcbnew/zones_by_polygon_fill_functions.cpp b/pcbnew/zones_by_polygon_fill_functions.cpp index 632702af80..d6cb064957 100644 --- a/pcbnew/zones_by_polygon_fill_functions.cpp +++ b/pcbnew/zones_by_polygon_fill_functions.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #define FORMAT_STRING _( "Filling zone %d out of %d (net %s)..." ) diff --git a/pcbnew/zones_polygons_insulated_copper_islands.cpp b/pcbnew/zones_polygons_insulated_copper_islands.cpp index 5fc36c7aa5..d107888c50 100644 --- a/pcbnew/zones_polygons_insulated_copper_islands.cpp +++ b/pcbnew/zones_polygons_insulated_copper_islands.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include void ZONE_CONTAINER::TestForCopperIslandAndRemoveInsulatedIslands( BOARD* aPcb ) { diff --git a/qa/common/pcb_test_frame.cpp b/qa/common/pcb_test_frame.cpp index 4b42ac0431..e7a582ac81 100644 --- a/qa/common/pcb_test_frame.cpp +++ b/qa/common/pcb_test_frame.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include