You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1470 lines
53 KiB

14 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
18 years ago
18 years ago
18 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
  5. * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file class_board.h
  26. * @brief Class BOARD to handle a board.
  27. */
  28. #ifndef CLASS_BOARD_H_
  29. #define CLASS_BOARD_H_
  30. #include <dlist.h>
  31. #include <layers_id_colors_and_visibility.h>
  32. #include <class_netinfo.h>
  33. #include <class_pad.h>
  34. #include <class_colors_design_settings.h>
  35. #include <class_board_design_settings.h>
  36. #include <common.h> // PAGE_INFO
  37. #include <class_title_block.h>
  38. #include <class_zone_settings.h>
  39. #include <pcb_plot_params.h>
  40. class PCB_BASE_FRAME;
  41. class PCB_EDIT_FRAME;
  42. class PICKED_ITEMS_LIST;
  43. class BOARD;
  44. class ZONE_CONTAINER;
  45. class SEGZONE;
  46. class TRACK;
  47. class D_PAD;
  48. class MARKER_PCB;
  49. class MSG_PANEL_ITEM;
  50. class NETLIST;
  51. class REPORTER;
  52. // non-owning container of item candidates when searching for items on the same track.
  53. typedef std::vector< TRACK* > TRACK_PTRS;
  54. #define HISTORY_MAX_COUNT 8
  55. /**
  56. * Enum LAYER_T
  57. * gives the allowed types of layers, same as Specctra DSN spec.
  58. */
  59. enum LAYER_T
  60. {
  61. LT_UNDEFINED = -1,
  62. LT_SIGNAL,
  63. LT_POWER,
  64. LT_MIXED,
  65. LT_JUMPER
  66. };
  67. /**
  68. * Class LAYER
  69. * holds information pertinent to a layer of a BOARD.
  70. */
  71. class LAYER
  72. {
  73. public:
  74. LAYER( const wxString& aName = wxEmptyString, LAYER_T aType = LT_SIGNAL,
  75. bool aVisible = true ) :
  76. m_Name( aName ),
  77. m_Type( aType ),
  78. m_visible( aVisible ),
  79. m_fixedListIndex( UNDEFINED_LAYER )
  80. {
  81. }
  82. void SetVisible( bool aEnable ) { m_visible = aEnable; }
  83. bool IsVisible() const { return m_visible; }
  84. void SetFixedListIndex( int aIndex ) { m_fixedListIndex = aIndex; }
  85. int GetFixedListIndex() const { return m_fixedListIndex; }
  86. /** The name of the layer, there should be no spaces in this name. */
  87. wxString m_Name;
  88. /** The type of the layer */
  89. LAYER_T m_Type;
  90. // int m_Color;
  91. /**
  92. * Function ShowType
  93. * converts a LAYER_T enum to a const char*
  94. * @param aType The LAYER_T to convert
  95. * @return const char* - The string representation of the layer type.
  96. */
  97. static const char* ShowType( LAYER_T aType );
  98. /**
  99. * Function ParseType
  100. * converts a string to a LAYER_T
  101. * @param aType The const char* to convert
  102. * @return LAYER_T - The binary representation of the layer type, or
  103. * LAYER_T(-1) if the string is invalid
  104. */
  105. static LAYER_T ParseType( const char* aType );
  106. private:
  107. bool m_visible;
  108. int m_fixedListIndex;
  109. };
  110. /**
  111. * Struct VIA_DIMENSION
  112. * is a small helper container to handle a stock of specific vias each with
  113. * unique diameter and drill sizes in the BOARD class.
  114. */
  115. struct VIA_DIMENSION
  116. {
  117. int m_Diameter; // <= 0 means use Netclass via diameter
  118. int m_Drill; // <= 0 means use Netclass via drill
  119. VIA_DIMENSION()
  120. {
  121. m_Diameter = 0;
  122. m_Drill = 0;
  123. }
  124. VIA_DIMENSION( int aDiameter, int aDrill )
  125. {
  126. m_Diameter = aDiameter;
  127. m_Drill = aDrill;
  128. }
  129. bool operator == ( const VIA_DIMENSION& other ) const
  130. {
  131. return (m_Diameter == other.m_Diameter) && (m_Drill == other.m_Drill);
  132. }
  133. bool operator < ( const VIA_DIMENSION& other ) const
  134. {
  135. if( m_Diameter != other.m_Diameter )
  136. return m_Diameter < other.m_Diameter;
  137. return m_Drill < other.m_Drill;
  138. }
  139. };
  140. // Helper class to handle high light nets
  141. class HIGH_LIGHT_INFO
  142. {
  143. friend class BOARD;
  144. protected:
  145. int m_netCode; // net selected for highlight (-1 when no net selected )
  146. bool m_highLightOn; // highlight active
  147. protected:
  148. void Clear()
  149. {
  150. m_netCode = -1;
  151. m_highLightOn = false;
  152. }
  153. HIGH_LIGHT_INFO()
  154. {
  155. Clear();
  156. }
  157. };
  158. /**
  159. * Class BOARD
  160. * holds information pertinent to a Pcbnew printed circuit board.
  161. */
  162. class BOARD : public BOARD_ITEM
  163. {
  164. friend class PCB_EDIT_FRAME;
  165. private:
  166. /// the board filename
  167. wxString m_fileName;
  168. // @todo: switch to boost:ptr_vector, and change ~BOARD()
  169. typedef std::vector<MARKER_PCB*> MARKERS;
  170. /// MARKER_PCBs for clearance problems, owned by pointer.
  171. MARKERS m_markers;
  172. // @todo: switch to boost::ptr_vector, and change ~BOARD()
  173. typedef std::vector<ZONE_CONTAINER*> ZONE_CONTAINERS;
  174. /// edge zone descriptors, owned by pointer.
  175. ZONE_CONTAINERS m_ZoneDescriptorList;
  176. LAYER m_Layer[NB_LAYERS];
  177. wxPoint m_grid_origin;
  178. // if true m_highLight_NetCode is used
  179. HIGH_LIGHT_INFO m_highLight; // current high light data
  180. HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
  181. int m_fileFormatVersionAtLoad; ///< the version loaded from the file
  182. EDA_RECT m_BoundingBox;
  183. NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
  184. BOARD_DESIGN_SETTINGS m_designSettings;
  185. ZONE_SETTINGS m_zoneSettings;
  186. COLORS_DESIGN_SETTINGS* m_colorsSettings;
  187. PAGE_INFO m_paper;
  188. TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
  189. PCB_PLOT_PARAMS m_plotOptions;
  190. /// Number of pads connected to the current net.
  191. int m_nodeCount;
  192. /// Number of unconnected nets in the current rats nest.
  193. int m_unconnectedNetCount;
  194. /// Current net class name used to display netclass info.
  195. /// This is also the last used netclass after starting a track.
  196. wxString m_currentNetClassName;
  197. /// Index for #m_ViasDimensionsList to select the current via size.
  198. /// 0 is the index selection of the default value Netclass
  199. unsigned m_viaSizeIndex;
  200. // Index for m_TrackWidthList to select the value.
  201. unsigned m_trackWidthIndex;
  202. /**
  203. * Function chainMarkedSegments
  204. * is used by MarkTrace() to set the BUSY flag of connected segments of the trace
  205. * segment located at \a aPosition on aLayerMask.
  206. * Vias are put in list but their flags BUSY is not set
  207. * @param aPosition A wxPoint object containing the position of the starting search.
  208. * @param aLayerMask The allowed layers for segments to search.
  209. * @param aList The track list to fill with points of flagged segments.
  210. */
  211. void chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_PTRS* aList );
  212. void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel,
  213. int aControlBits ) const
  214. throw( IO_ERROR );
  215. public:
  216. void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
  217. const wxString &GetFileName() const { return m_fileName; }
  218. /// Flags used in ratsnest calculation and update.
  219. int m_Status_Pcb;
  220. DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
  221. DLIST<MODULE> m_Modules; // linked list of MODULEs
  222. DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs
  223. DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs
  224. /// Ratsnest list for the BOARD
  225. std::vector<RATSNEST_ITEM> m_FullRatsnest;
  226. /// Ratsnest list relative to a given footprint (used while moving a footprint).
  227. std::vector<RATSNEST_ITEM> m_LocalRatsnest;
  228. /// zone contour currently in progress
  229. ZONE_CONTAINER* m_CurrentZoneContour;
  230. /// List of current netclasses. There is always the default netclass.
  231. NETCLASSES m_NetClasses;
  232. // handling of vias and tracks size:
  233. // the first value is always the value of the current NetClass
  234. // The others values are extra values
  235. /// Vias size and drill list(max count = HISTORY_MAX_COUNT)
  236. std::vector <VIA_DIMENSION> m_ViasDimensionsList;
  237. // The first value is the current netclass via size
  238. // tracks widths (max count = HISTORY_MAX_COUNT)
  239. // The first value is the current netclass track width
  240. std::vector <int> m_TrackWidthList;
  241. BOARD();
  242. ~BOARD();
  243. bool IsEmpty() const
  244. {
  245. return m_Drawings.GetCount() == 0 && m_Modules.GetCount() == 0 &&
  246. m_Track.GetCount() == 0 && m_Zone.GetCount() == 0;
  247. }
  248. void Move( const wxPoint& aMoveVector ); // overload
  249. void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
  250. int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
  251. /**
  252. * Function Add
  253. * adds the given item to this BOARD and takes ownership of its memory.
  254. * @param aBoardItem The item to add to this board.
  255. * @param aControl An int which can vary how the item is added.
  256. */
  257. void Add( BOARD_ITEM* aBoardItem, int aControl = 0 );
  258. #define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts
  259. /**
  260. * Function Delete
  261. * removes the given single item from this BOARD and deletes its memory.
  262. * @param aBoardItem The item to remove from this board and delete
  263. */
  264. void Delete( BOARD_ITEM* aBoardItem )
  265. {
  266. // developers should run DEBUG versions and fix such calls with NULL
  267. wxASSERT( aBoardItem );
  268. if( aBoardItem )
  269. delete Remove( aBoardItem );
  270. }
  271. /**
  272. * Function Remove
  273. * removes \a aBoardItem from this BOARD and returns it to caller without deleting it.
  274. * @param aBoardItem The item to remove from this board.
  275. * @return BOARD_ITEM* \a aBoardItem which was passed in.
  276. */
  277. BOARD_ITEM* Remove( BOARD_ITEM* aBoardItem );
  278. /**
  279. * Function DeleteMARKERs
  280. * deletes ALL MARKERS from the board.
  281. */
  282. void DeleteMARKERs();
  283. /**
  284. * Function DeleteZONEOutlines
  285. * deletes ALL zone outlines from the board.
  286. */
  287. void DeleteZONEOutlines();
  288. /**
  289. * Function GetMARKER
  290. * returns the MARKER at a given index.
  291. * @param index The array type index into a collection of MARKER_PCBS.
  292. * @return MARKER_PCB* - a pointer to the MARKER_PCB or NULL if index out of range.
  293. */
  294. MARKER_PCB* GetMARKER( int index ) const
  295. {
  296. if( (unsigned) index < m_markers.size() )
  297. return m_markers[index];
  298. return NULL;
  299. }
  300. /**
  301. * Function GetMARKERCount
  302. * @return int - The number of MARKER_PCBS.
  303. */
  304. int GetMARKERCount() const
  305. {
  306. return (int) m_markers.size();
  307. }
  308. /**
  309. * Function SetAuxOrigin
  310. * sets the origin point used for plotting.
  311. */
  312. void SetAuxOrigin( const wxPoint& aPoint ) { m_designSettings.m_AuxOrigin = aPoint; }
  313. const wxPoint& GetAuxOrigin() const { return m_designSettings.m_AuxOrigin; }
  314. /**
  315. * Function SetGridOrigin
  316. * sets the origin point of the grid.
  317. */
  318. void SetGridOrigin( const wxPoint& aPoint ) { m_designSettings.m_GridOrigin = aPoint; }
  319. const wxPoint& GetGridOrigin() const { return m_designSettings.m_GridOrigin; }
  320. /**
  321. * Function ResetHighLight
  322. * Reset all high light data to the init state
  323. */
  324. void ResetHighLight()
  325. {
  326. m_highLight.Clear();
  327. m_highLightPrevious.Clear();
  328. }
  329. /**
  330. * Function GetHighLightNetCode
  331. * @return netcode of net to highlight (-1 when no net selected)
  332. */
  333. int GetHighLightNetCode() { return m_highLight.m_netCode; }
  334. /**
  335. * Function SetHighLightNet
  336. * @param aNetCode = netcode of net to highlight
  337. */
  338. void SetHighLightNet( int aNetCode)
  339. {
  340. m_highLight.m_netCode = aNetCode;
  341. }
  342. /**
  343. * Function IsHighLightNetON
  344. * @return true if a net is currently highlighted
  345. */
  346. bool IsHighLightNetON() { return m_highLight.m_highLightOn; }
  347. /**
  348. * Function HighLightOFF
  349. * Disable highlight.
  350. */
  351. void HighLightOFF() { m_highLight.m_highLightOn = false; }
  352. /**
  353. * Function HighLightON
  354. * Enable highlight.
  355. * if m_highLight_NetCode >= 0, this net will be highlighted
  356. */
  357. void HighLightON() { m_highLight.m_highLightOn = true; }
  358. /**
  359. * Function PushHighLight
  360. * save current high light info for later use
  361. */
  362. void PushHighLight();
  363. /**
  364. * Function PopHighLight
  365. * retrieve a previously saved high light info
  366. */
  367. void PopHighLight();
  368. /**
  369. * Function GetCopperLayerCount
  370. * @return int - The number of copper layers in the BOARD.
  371. */
  372. int GetCopperLayerCount() const;
  373. void SetCopperLayerCount( int aCount );
  374. /**
  375. * Function GetEnabledLayers
  376. * is a proxy function that calls the correspondent function in m_BoardSettings
  377. * Returns a bit-mask of all the layers that are enabled
  378. * @return int - the enabled layers in bit-mapped form.
  379. */
  380. LAYER_MSK GetEnabledLayers() const;
  381. /**
  382. * Function SetEnabledLayers
  383. * is a proxy function that calls the correspondent function in m_BoardSettings
  384. * Changes the bit-mask of enabled layers
  385. * @param aLayerMask = The new bit-mask of enabled layers
  386. */
  387. void SetEnabledLayers( LAYER_MSK aLayerMask );
  388. /**
  389. * Function IsLayerEnabled
  390. * is a proxy function that calls the correspondent function in m_BoardSettings
  391. * tests whether a given layer is enabled
  392. * @param aLayer = The layer to be tested
  393. * @return bool - true if the layer is visible.
  394. */
  395. bool IsLayerEnabled( LAYER_NUM aLayer ) const
  396. {
  397. return m_designSettings.IsLayerEnabled( aLayer );
  398. }
  399. /**
  400. * Function IsLayerVisible
  401. * is a proxy function that calls the correspondent function in m_BoardSettings
  402. * tests whether a given layer is visible
  403. * @param aLayer = The layer to be tested
  404. * @return bool - true if the layer is visible.
  405. */
  406. bool IsLayerVisible( LAYER_NUM aLayer ) const
  407. {
  408. return m_designSettings.IsLayerVisible( aLayer );
  409. }
  410. /**
  411. * Function GetVisibleLayers
  412. * is a proxy function that calls the correspondent function in m_BoardSettings
  413. * Returns a bit-mask of all the layers that are visible
  414. * @return int - the visible layers in bit-mapped form.
  415. */
  416. LAYER_MSK GetVisibleLayers() const;
  417. /**
  418. * Function SetVisibleLayers
  419. * is a proxy function that calls the correspondent function in m_BoardSettings
  420. * changes the bit-mask of visible layers
  421. * @param aLayerMask = The new bit-mask of visible layers
  422. */
  423. void SetVisibleLayers( LAYER_MSK aLayerMask );
  424. // these 2 functions are not tidy at this time, since there are PCB_VISIBLEs that
  425. // are not stored in the bitmap.
  426. /**
  427. * Function GetVisibleElements
  428. * is a proxy function that calls the correspondent function in m_BoardSettings
  429. * returns a bit-mask of all the element categories that are visible
  430. * @return int - the visible element bitmap or-ed from enum PCB_VISIBLE
  431. * @see enum PCB_VISIBLE
  432. */
  433. int GetVisibleElements() const;
  434. /**
  435. * Function SetVisibleElements
  436. * is a proxy function that calls the correspondent function in m_BoardSettings
  437. * changes the bit-mask of visible element categories
  438. * @param aMask = The new bit-mask of visible element bitmap or-ed from enum PCB_VISIBLE
  439. * @see enum PCB_VISIBLE
  440. */
  441. void SetVisibleElements( int aMask );
  442. /**
  443. * Function SetVisibleAlls
  444. * changes the bit-mask of visible element categories and layers
  445. * @see enum PCB_VISIBLE
  446. */
  447. void SetVisibleAlls();
  448. /**
  449. * Function IsElementVisible
  450. * tests whether a given element category is visible. Keep this as an
  451. * inline function.
  452. * @param aPCB_VISIBLE is from the enum by the same name
  453. * @return bool - true if the element is visible.
  454. * @see enum PCB_VISIBLE
  455. */
  456. bool IsElementVisible( int aPCB_VISIBLE ) const;
  457. /**
  458. * Function SetElementVisibility
  459. * changes the visibility of an element category
  460. * @param aPCB_VISIBLE is from the enum by the same name
  461. * @param aNewState = The new visibility state of the element category
  462. * @see enum PCB_VISIBLE
  463. */
  464. void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );
  465. /**
  466. * Function IsModuleLayerVisible
  467. * expects either of the two layers on which a module can reside, and returns
  468. * whether that layer is visible.
  469. * @param layer One of the two allowed layers for modules: LAYER_N_FRONT or LAYER_N_BACK
  470. * @return bool - true if the layer is visible, else false.
  471. */
  472. bool IsModuleLayerVisible( LAYER_NUM layer );
  473. /**
  474. * Function GetVisibleElementColor
  475. * returns the color of a pcb visible element.
  476. * @see enum PCB_VISIBLE
  477. */
  478. EDA_COLOR_T GetVisibleElementColor( int aPCB_VISIBLE );
  479. void SetVisibleElementColor( int aPCB_VISIBLE, EDA_COLOR_T aColor );
  480. /**
  481. * Function GetDesignSettings
  482. * @return the BOARD_DESIGN_SETTINGS for this BOARD
  483. */
  484. BOARD_DESIGN_SETTINGS& GetDesignSettings() const
  485. {
  486. // remove const-ness with cast.
  487. return (BOARD_DESIGN_SETTINGS&) m_designSettings;
  488. }
  489. /**
  490. * Function SetDesignSettings
  491. * @param aDesignSettings the new BOARD_DESIGN_SETTINGS to use
  492. */
  493. void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings ) { m_designSettings = aDesignSettings; }
  494. const PAGE_INFO& GetPageSettings() const { return m_paper; }
  495. void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
  496. const PCB_PLOT_PARAMS& GetPlotOptions() const { return m_plotOptions; }
  497. void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
  498. TITLE_BLOCK& GetTitleBlock() { return m_titles; }
  499. void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
  500. const ZONE_SETTINGS& GetZoneSettings() const { return m_zoneSettings; }
  501. void SetZoneSettings( const ZONE_SETTINGS& aSettings ) { m_zoneSettings = aSettings; }
  502. /**
  503. * Function GetColorSettings
  504. * @return the current COLORS_DESIGN_SETTINGS in use
  505. */
  506. COLORS_DESIGN_SETTINGS* GetColorsSettings() const { return m_colorsSettings; }
  507. /**
  508. * Function SetColorsSettings
  509. * @param aColorsSettings = the new COLORS_DESIGN_SETTINGS to use
  510. */
  511. void SetColorsSettings( COLORS_DESIGN_SETTINGS* aColorsSettings )
  512. {
  513. m_colorsSettings = aColorsSettings;
  514. }
  515. /**
  516. * Function GetBoardPolygonOutlines
  517. * Extracts the board outlines and build a closed polygon
  518. * from lines, arcs and circle items on edge cut layer
  519. * Any closed outline inside the main outline is a hole
  520. * All contours should be closed, i.e. have valid vertices to build a closed polygon
  521. * @param aOutlines The CPOLYGONS_LIST to fill in with main outlines.
  522. * @param aHoles The empty CPOLYGONS_LIST to fill in with holes, if any.
  523. * @param aErrorText = a wxString reference to display an error message
  524. * with the coordinate of the point which creates the error
  525. * (default = NULL , no message returned on error)
  526. * @return true if success, false if a contour is not valid
  527. */
  528. bool GetBoardPolygonOutlines( CPOLYGONS_LIST& aOutlines,
  529. CPOLYGONS_LIST& aHoles,
  530. wxString* aErrorText = NULL );
  531. /**
  532. * Function GetLayerName
  533. * returns the name of a layer given by aLayer. Copper layers may
  534. * have custom names.
  535. *
  536. * @param aLayer = A layer, like LAYER_N_BACK, etc.
  537. *
  538. * @return wxString - the layer name, which for copper layers may
  539. * be custom, else standard.
  540. */
  541. wxString GetLayerName( LAYER_NUM aLayer ) const;
  542. /**
  543. * Function SetLayerName
  544. * changes the name of the layer given by aLayer.
  545. *
  546. * @param aLayer A layer, like LAYER_N_BACK, etc.
  547. * @param aLayerName The new layer name
  548. * @return bool - true if aLayerName was legal and unique among other
  549. * layer names at other layer indices and aLayer was within range, else false.
  550. */
  551. bool SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName );
  552. /**
  553. * Function GetStandardLayerName
  554. * returns an "English Standard" name of a PCB layer when given \a aLayerNumber.
  555. * This function is static so it can be called without a BOARD instance. Use
  556. * GetLayerName() if want the layer names of a specific BOARD, which could
  557. * be different than the default if the user has renamed any copper layers.
  558. *
  559. * @param aLayerNumber is the layer number to fetch
  560. * @return wxString - containing the layer name or "BAD INDEX" if aLayerNumber
  561. * is not legal
  562. */
  563. static wxString GetStandardLayerName( LAYER_NUM aLayerNumber );
  564. bool SetLayer( LAYER_NUM aIndex, const LAYER& aLayer );
  565. /**
  566. * Function GetLayerType
  567. * returns the type of the copper layer given by aLayer.
  568. *
  569. * @param aLayer A layer index, like LAYER_N_BACK, etc.
  570. * @return LAYER_T - the layer type, or LAYER_T(-1) if the
  571. * index was out of range.
  572. */
  573. LAYER_T GetLayerType( LAYER_NUM aLayer ) const;
  574. /**
  575. * Function SetLayerType
  576. * changes the type of the layer given by aLayer.
  577. *
  578. * @param aLayer A layer index, like LAYER_N_BACK, etc.
  579. * @param aLayerType The new layer type.
  580. * @return bool - true if aLayerType was legal and aLayer was within range, else false.
  581. */
  582. bool SetLayerType( LAYER_NUM aLayer, LAYER_T aLayerType );
  583. /**
  584. * Function SetLayerColor
  585. * changes a layer color for any valid layer, including non-copper ones.
  586. */
  587. void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
  588. /**
  589. * Function GetLayerColor
  590. * gets a layer color for any valid layer, including non-copper ones.
  591. */
  592. EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
  593. /** Functions to get some items count */
  594. int GetNumSegmTrack() const;
  595. /** Calculate the zone segment count */
  596. int GetNumSegmZone() const;
  597. /**
  598. * Function GetNumRatsnests
  599. * @return int - The number of rats
  600. */
  601. unsigned GetRatsnestsCount() const
  602. {
  603. return m_FullRatsnest.size();
  604. }
  605. /**
  606. * Function GetNodesCount
  607. * @return the number of pads members of nets (i.e. with netcode > 0)
  608. */
  609. unsigned GetNodesCount() const;
  610. /**
  611. * Function SetNodeCount
  612. * set the number of nodes of the current net to \a aCount.
  613. *
  614. * @param aCount is the number of nodes attached to the current net.
  615. */
  616. void SetNodeCount( unsigned aCount ) { m_nodeCount = aCount; }
  617. /**
  618. * Function GetUnconnectedNetCount
  619. * @return the number of unconnected nets in the current rats nest.
  620. */
  621. unsigned GetUnconnectedNetCount() const { return m_unconnectedNetCount; }
  622. /**
  623. * Function SetUnconnectedNetCount
  624. * sets the number of unconnected nets in the current rats nest to \a aCount.
  625. *
  626. * @param aCount is the number of unconneceted nets in the current rats nest.
  627. */
  628. void SetUnconnectedNetCount( unsigned aCount ) { m_unconnectedNetCount = aCount; }
  629. /**
  630. * Function SetCurrentNetClassName
  631. * sets the current net class name to \a aName.
  632. *
  633. * @param aName is a reference to a wxString object containing the current net class name.
  634. */
  635. void SetCurrentNetClassName( const wxString& aName ) { m_currentNetClassName = aName; }
  636. /**
  637. * Function GetCurrentNetClassName
  638. * @return the current net class name.
  639. */
  640. const wxString& GetCurrentNetClassName() const { return m_currentNetClassName; }
  641. /**
  642. * Function GetPadCount
  643. * @return the number of pads in board
  644. */
  645. unsigned GetPadCount() const
  646. {
  647. return m_NetInfo.GetPadCount();
  648. }
  649. /**
  650. * Function GetPad
  651. * @return D_PAD* - at the \a aIndex from m_NetInfo
  652. */
  653. D_PAD* GetPad( unsigned aIndex ) const
  654. {
  655. return m_NetInfo.GetPad( aIndex );
  656. }
  657. /**
  658. * Function GetPads
  659. * returns a list of all the pads by value. The returned list is not
  660. * sorted and contains pointers to PADS, but those pointers do not convey
  661. * ownership of the respective PADs.
  662. * @return std::vector<D_PAD*> - a full list of pads
  663. */
  664. std::vector<D_PAD*> GetPads()
  665. {
  666. return m_NetInfo.m_PadsFullList;
  667. }
  668. void BuildListOfNets()
  669. {
  670. m_NetInfo.buildListOfNets();
  671. }
  672. /**
  673. * Function FindNet
  674. * searches for a net with the given netcode.
  675. * @param aNetcode A netcode to search for.
  676. * @return NETINFO_ITEM_ITEM* - the net or NULL if not found.
  677. */
  678. NETINFO_ITEM* FindNet( int aNetcode ) const;
  679. /**
  680. * Function FindNet overloaded
  681. * searches for a net with the given name.
  682. * @param aNetname A Netname to search for.
  683. * @return NETINFO_ITEM* - the net or NULL if not found.
  684. */
  685. NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
  686. void AppendNet( NETINFO_ITEM* aNewNet )
  687. {
  688. m_NetInfo.AppendNet( aNewNet );
  689. }
  690. /**
  691. * Function GetNetCount
  692. * @return the number of nets (NETINFO_ITEM)
  693. */
  694. unsigned GetNetCount() const
  695. {
  696. return m_NetInfo.GetNetCount();
  697. }
  698. /**
  699. * Function ComputeBoundingBox
  700. * calculates the bounding box containing all board items (or board edge segments).
  701. * @param aBoardEdgesOnly is true if we are interested in board edge segments only.
  702. * @return EDA_RECT - the board's bounding box
  703. * @see PCB_BASE_FRAME::GetBoardBoundingBox() which calls this and doctors the result
  704. */
  705. EDA_RECT ComputeBoundingBox( bool aBoardEdgesOnly = false );
  706. /**
  707. * Function GetBoundingBox
  708. * may be called soon after ComputeBoundingBox() to return the same EDA_RECT,
  709. * as long as the BOARD has not changed. Remember, ComputeBoundingBox()'s
  710. * aBoardEdgesOnly argument is considered in this return value also.
  711. */
  712. EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override
  713. void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
  714. void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
  715. /**
  716. * Function Draw.
  717. * Redraw the BOARD items but not cursors, axis or grid.
  718. * @param aPanel = the panel relative to the board
  719. * @param aDC = the current device context
  720. * @param aDrawMode = GR_COPY, GR_OR ... (not always used)
  721. * @param aOffset = an draw offset value (default = 0,0)
  722. */
  723. void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
  724. GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset );
  725. /**
  726. * Function DrawHighLight
  727. * redraws the objects in the board that are associated with the given aNetCode
  728. * and turns on or off the brilliance associated with that net according to the
  729. * current value of global g_HighLight_Status
  730. * @param aDrawPanel is needed for the clipping support.
  731. * @param aDC = the current device context
  732. * @param aNetCode is the net number to highlight or to dim.
  733. */
  734. void DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* aDC, int aNetCode );
  735. /**
  736. * Function Visit
  737. * may be re-implemented for each derived class in order to handle
  738. * all the types given by its member data. Implementations should call
  739. * inspector->Inspect() on types in scanTypes[], and may use IterateForward()
  740. * to do so on lists of such data.
  741. * @param inspector An INSPECTOR instance to use in the inspection.
  742. * @param testData Arbitrary data used by the inspector.
  743. * @param scanTypes Which KICAD_T types are of interest and the order
  744. * is significant too, terminated by EOT.
  745. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
  746. * else SCAN_CONTINUE, and determined by the inspector.
  747. */
  748. SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
  749. const KICAD_T scanTypes[] );
  750. /**
  751. * Function FindModuleByReference
  752. * searches for a MODULE within this board with the given
  753. * reference designator. Finds only the first one, if there
  754. * is more than one such MODULE.
  755. * @param aReference The reference designator of the MODULE to find.
  756. * @return MODULE* - If found, the MODULE having the given reference
  757. * designator, else NULL.
  758. */
  759. MODULE* FindModuleByReference( const wxString& aReference ) const;
  760. /**
  761. * Function FindModule
  762. * searches for a module matching \a aRefOrTimeStamp depending on the state of
  763. * \a aSearchByTimeStamp.
  764. * @param aRefOrTimeStamp is the search string.
  765. * @param aSearchByTimeStamp searches by the module time stamp value if true. Otherwise
  766. * search by reference designator.
  767. * @return the module found or NULL if not module is found that meets the search criteria.
  768. */
  769. MODULE* FindModule( const wxString& aRefOrTimeStamp, bool aSearchByTimeStamp = false );
  770. /**
  771. * Function ReplaceNetlist
  772. * updates the #BOARD according to \a aNetlist.
  773. *
  774. * The changes are made to the board are as follows they are not disabled in the status
  775. * settings in the #NETLIST:
  776. * - If a new component is found in the #NETLIST and not in the #BOARD, it is added
  777. * to the #BOARD.
  778. * - If a the component in the #NETLIST is already on the #BOARD, then one or more of the
  779. * following actions can occur:
  780. * + If the footprint name in the #NETLIST does not match the footprint name on the
  781. * #BOARD, the footprint on the #BOARD is replaced with the footprint specified in
  782. * the #NETLIST and the proper parameters are copied from the existing footprint.
  783. * + If the reference designator in the #NETLIST does not match the reference designator
  784. * on the #BOARD, the reference designator is updated from the #NETLIST.
  785. * + If the value field in the #NETLIST does not match the value field on the #BOARD,
  786. * the value field is updated from the #NETLIST.
  787. * + If the time stamp in the #NETLIST does not match the time stamp on the #BOARD,
  788. * the time stamp is updated from the #NETLIST.
  789. * - After each footprint is added or update as described above, each footprint pad net
  790. * name is compared and updated to the value defined in the #NETLIST.
  791. * - After all of the footprints have been added, updated, and net names properly set,
  792. * any extra unlock footprints are removed from the #BOARD.
  793. *
  794. * @param aNetlist is the new netlist to revise the contents of the #BOARD with.
  795. * @param aDeleteSinglePadNets if true, remove nets counting only one pad
  796. * and set net code to 0 for these pads
  797. * @param aReporter is a #REPORTER object to report the changes \a aNetlist makes to
  798. * the #BOARD. If NULL, no change reporting occurs.
  799. */
  800. void ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
  801. REPORTER* aReporter = NULL );
  802. /**
  803. * Function ReturnSortedNetnamesList
  804. * @param aNames An array string to fill with net names.
  805. * @param aSortbyPadsCount true = sort by active pads count, false = no sort (i.e.
  806. * leave the sort by net names)
  807. * @return int - net names count.
  808. */
  809. int ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
  810. /**************************************/
  811. /**
  812. * Function relative to NetClasses: **/
  813. /**************************************/
  814. /**
  815. * Function SynchronizeNetsAndNetClasses
  816. * copies NETCLASS info to each NET, based on NET membership in a NETCLASS.
  817. * Must be called after a Design Rules edition, or after reading a netlist (or editing
  818. * the list of nets) Also this function removes the non existing nets in netclasses
  819. * and add net nets in default netclass (this happens after reading a netlist)
  820. */
  821. void SynchronizeNetsAndNetClasses();
  822. /**
  823. * Function SetCurrentNetClass
  824. * Must be called after a netclass selection (or after a netclass parameter change
  825. * Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
  826. * and some others parameters (netclass name ....)
  827. * @param aNetClassName = the new netclass name
  828. * @return true if lists of tracks and vias sizes are modified
  829. */
  830. bool SetCurrentNetClass( const wxString& aNetClassName );
  831. /**
  832. * Function GetBiggestClearanceValue
  833. * @return the biggest clearance value found in NetClasses list
  834. */
  835. int GetBiggestClearanceValue();
  836. /**
  837. * Function GetSmallestClearanceValue
  838. * @return the smallest clearance value found in NetClasses list
  839. */
  840. int GetSmallestClearanceValue();
  841. /**
  842. * Function GetTrackWidthIndex
  843. * @return the current track width list index.
  844. */
  845. unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
  846. /**
  847. * Function SetTrackWidthIndex
  848. * sets the current track width list index to \a aIndex.
  849. *
  850. * @param aIndex is the track width list index.
  851. */
  852. void SetTrackWidthIndex( unsigned aIndex );
  853. /**
  854. * Function GetCurrentTrackWidth
  855. * @return the current track width, according to the selected options
  856. * ( using the default netclass value or a preset value )
  857. * the default netclass is always in m_TrackWidthList[0]
  858. */
  859. int GetCurrentTrackWidth() const
  860. {
  861. return m_TrackWidthList[m_trackWidthIndex];
  862. }
  863. /**
  864. * Function GetViaSizeIndex
  865. * @return the current via size list index.
  866. */
  867. unsigned GetViaSizeIndex() const { return m_viaSizeIndex; }
  868. /**
  869. * Function SetViaSizeIndex
  870. * sets the current via size list index to \a aIndex.
  871. *
  872. * @param aIndex is the via size list index.
  873. */
  874. void SetViaSizeIndex( unsigned aIndex );
  875. /**
  876. * Function GetCurrentViaSize
  877. * @return the current via size, according to the selected options
  878. * ( using the default netclass value or a preset value )
  879. * the default netclass is always in m_TrackWidthList[0]
  880. */
  881. int GetCurrentViaSize()
  882. {
  883. return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter;
  884. }
  885. /**
  886. * Function GetCurrentViaDrill
  887. * @return the current via size, according to the selected options
  888. * ( using the default netclass value or a preset value )
  889. * the default netclass is always in m_TrackWidthList[0]
  890. */
  891. int GetCurrentViaDrill()
  892. {
  893. return m_ViasDimensionsList[m_viaSizeIndex].m_Drill > 0 ?
  894. m_ViasDimensionsList[m_viaSizeIndex].m_Drill : -1;
  895. }
  896. /**
  897. * Function GetCurrentMicroViaSize
  898. * @return the current micro via size,
  899. * that is the current netclass value
  900. */
  901. int GetCurrentMicroViaSize();
  902. /**
  903. * Function GetCurrentMicroViaDrill
  904. * @return the current micro via drill,
  905. * that is the current netclass value
  906. */
  907. int GetCurrentMicroViaDrill();
  908. /***************************************************************************/
  909. wxString GetClass() const
  910. {
  911. return wxT( "BOARD" );
  912. }
  913. #if defined(DEBUG)
  914. void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
  915. #endif
  916. /*************************/
  917. /* Copper Areas handling */
  918. /*************************/
  919. /**
  920. * Function HitTestForAnyFilledArea
  921. * tests if the given wxPoint is within the bounds of a filled area of this zone.
  922. * the test is made on zones on layer from aStartLayer to aEndLayer
  923. * Note: if a zone has its flag BUSY (in .m_State) is set, it is ignored.
  924. * @param aRefPos A wxPoint to test
  925. * @param aStartLayer the first layer to test
  926. * @param aEndLayer the last layer to test
  927. * @param aNetCode = the netcode used to filter zones (-1 to to test all zones)
  928. * @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
  929. */
  930. ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos,
  931. LAYER_NUM aStartLayer,
  932. LAYER_NUM aEndLayer,
  933. int aNetCode );
  934. /**
  935. * Function RedrawAreasOutlines
  936. * Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
  937. */
  938. void RedrawAreasOutlines( EDA_DRAW_PANEL* aPanel,
  939. wxDC* aDC,
  940. GR_DRAWMODE aDrawMode,
  941. LAYER_NUM aLayer );
  942. /**
  943. * Function RedrawFilledAreas
  944. * Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 )
  945. */
  946. void RedrawFilledAreas( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
  947. LAYER_NUM aLayer );
  948. /**
  949. * Function SetAreasNetCodesFromNetNames
  950. * Set the .m_NetCode member of all copper areas, according to the area Net Name
  951. * The SetNetCodesFromNetNames is an equivalent to net name, for fast comparisons.
  952. * However the Netcode is an arbitrary equivalence, it must be set after each netlist read
  953. * or net change
  954. * Must be called after pad netcodes are calculated
  955. * @return : error count
  956. * For non copper areas, netcode is set to 0
  957. */
  958. int SetAreasNetCodesFromNetNames( void );
  959. /**
  960. * Function GetArea
  961. * returns the Area (Zone Container) at a given index.
  962. * @param index The array type index into a collection of ZONE_CONTAINER *.
  963. * @return ZONE_CONTAINER* - a pointer to the Area or NULL if index out of range.
  964. */
  965. ZONE_CONTAINER* GetArea( int index ) const
  966. {
  967. if( (unsigned) index < m_ZoneDescriptorList.size() )
  968. return m_ZoneDescriptorList[index];
  969. return NULL;
  970. }
  971. /**
  972. * Function GetAreaIndex
  973. * returns the Area Index for the given Zone Container.
  974. * @param aArea :The ZONE_CONTAINER to find.
  975. * @return an Area Index in m_ZoneDescriptorList or -1 if non found.
  976. */
  977. int GetAreaIndex( const ZONE_CONTAINER* aArea ) const
  978. {
  979. for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
  980. {
  981. if( aArea == GetArea( ii ) ) // Found !
  982. return ii;
  983. }
  984. return -1;
  985. }
  986. /**
  987. * Function GetAreaCount
  988. * @return int - The number of Areas or ZONE_CONTAINER.
  989. */
  990. int GetAreaCount() const
  991. {
  992. return (int) m_ZoneDescriptorList.size();
  993. }
  994. /* Functions used in test, merge and cut outlines */
  995. /**
  996. * Function AddArea
  997. * Add an empty copper area to board areas list
  998. * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
  999. * in undo commands) can be NULL
  1000. * @param aNetcode = the netcode of the copper area (0 = no net)
  1001. * @param aLayer = the layer of area
  1002. * @param aStartPointPosition = position of the first point of the polygon outline of this area
  1003. * @param aHatch = hatch option
  1004. * @return a reference to the new area
  1005. */
  1006. ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
  1007. LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch );
  1008. /**
  1009. * Function InsertArea
  1010. * add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
  1011. * @return pointer to the new area
  1012. */
  1013. ZONE_CONTAINER* InsertArea( int netcode, int iarea, LAYER_NUM layer, int x, int y, int hatch );
  1014. /**
  1015. * Function NormalizeAreaPolygon
  1016. * Process an area that has been modified, by normalizing its polygon against itself.
  1017. * i.e. convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s)
  1018. * This may change the number and order of copper areas in the net.
  1019. * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new created areas pickers
  1020. * @param aCurrArea = the zone to process
  1021. * @return true if changes are made
  1022. */
  1023. bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE_CONTAINER* aCurrArea );
  1024. /**
  1025. * Function OnAreaPolygonModified
  1026. * Process an area that has been modified, by normalizing its polygon
  1027. * and merging the intersecting polygons for any other areas on the same net.
  1028. * This may change the number and order of copper areas in the net.
  1029. * @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas
  1030. * (useful in undo commands can be NULL
  1031. * @param modified_area = area to test
  1032. * @return true if some areas modified
  1033. */
  1034. bool OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
  1035. ZONE_CONTAINER* modified_area );
  1036. /**
  1037. * Function CombineAllAreasInNet
  1038. * Checks all copper areas in net for intersections, combining them if found
  1039. * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
  1040. * in undo commands can be NULL
  1041. * @param aNetCode = net to consider
  1042. * @param aUseLocalFlags : if true, don't check areas if both local flags are 0
  1043. * Sets local flag = 1 for any areas modified
  1044. * @return true if some areas modified
  1045. */
  1046. bool CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList,
  1047. int aNetCode,
  1048. bool aUseLocalFlags );
  1049. /**
  1050. * Function RemoveArea
  1051. * remove copper area from net, and put it in a deleted list (if exists)
  1052. * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
  1053. * in undo commands can be NULL
  1054. * @param area_to_remove = area to delete or put in deleted list
  1055. */
  1056. void RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to_remove );
  1057. /**
  1058. * Function TestAreaIntersections
  1059. * Check for intersection of a given copper area with other areas in same net
  1060. * @param area_to_test = area to compare to all other areas in the same net
  1061. */
  1062. bool TestAreaIntersections( ZONE_CONTAINER* area_to_test );
  1063. /**
  1064. * Function TestAreaIntersection
  1065. * Test for intersection of 2 copper areas
  1066. * area_to_test must be after area_ref in m_ZoneDescriptorList
  1067. * @param area_ref = area reference
  1068. * @param area_to_test = area to compare for intersection calculations
  1069. * @return : false if no intersection, true if intersection
  1070. */
  1071. bool TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_test );
  1072. /**
  1073. * Function CombineAreas
  1074. * If possible, combine 2 copper areas
  1075. * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas
  1076. * (useful for undo).
  1077. * @param area_ref = the main area (zone)
  1078. * @param area_to_combine = the zone that can be merged with area_ref
  1079. * area_ref must be BEFORE area_to_combine
  1080. * area_to_combine will be deleted, if areas are combined
  1081. * @return : true if area_to_combine is combined with area_ref (and therefore be deleted)
  1082. */
  1083. bool CombineAreas( PICKED_ITEMS_LIST* aDeletedList,
  1084. ZONE_CONTAINER* area_ref,
  1085. ZONE_CONTAINER* area_to_combine );
  1086. /**
  1087. * Function Test_Drc_Areas_Outlines_To_Areas_Outlines
  1088. * tests area outlines for DRC:
  1089. * Tests areas inside other areas.
  1090. * Tests areas too close.
  1091. *
  1092. * @param aArea_To_Examine: area to compare with other areas, or if NULL then
  1093. * all areas are compared to all others.
  1094. * @param aCreate_Markers: if true create DRC markers. False: do not creates anything
  1095. * @return errors count
  1096. */
  1097. int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,
  1098. bool aCreate_Markers );
  1099. /****** function relative to ratsnest calculations: */
  1100. /**
  1101. * Function Test_Connection_To_Copper_Areas
  1102. * init .m_ZoneSubnet parameter in tracks and pads according to the connections to areas found
  1103. * @param aNetcode = netcode to analyze. if -1, analyze all nets
  1104. */
  1105. void Test_Connections_To_Copper_Areas( int aNetcode = -1 );
  1106. /**
  1107. * Function GetViaByPosition
  1108. * finds the first via at \a aPosition on \a aLayer.
  1109. * <p>
  1110. * This function does not use the normal hit test to locate a via which which tests
  1111. * if a position is within the via's bounding box. It tests for the actual locate
  1112. * of the via.
  1113. * </p>
  1114. * @param aPosition The wxPoint to HitTest() against.
  1115. * @param aLayer The layer to search. Use -1 for a don't care.
  1116. * @return TRACK* A point a to the SEGVIA object if found, else NULL.
  1117. */
  1118. TRACK* GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER );
  1119. /**
  1120. * Function GetPad
  1121. * finds a pad \a aPosition on \a aLayer.
  1122. *
  1123. * @param aPosition A wxPoint object containing the position to hit test.
  1124. * @param aLayerMask A layer or layers to mask the hit test.
  1125. * @return A pointer to a D_PAD object if found or NULL if not found.
  1126. */
  1127. D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS );
  1128. /**
  1129. * Function GetPad
  1130. * finds a pad connected to \a aEndPoint of \a aTrace.
  1131. *
  1132. * @param aTrace A pointer to a TRACK object to hit test against.
  1133. * @param aEndPoint The end point of \a aTrace the hit test against.
  1134. * @return A pointer to a D_PAD object if found or NULL if not found.
  1135. */
  1136. D_PAD* GetPad( TRACK* aTrace, int aEndPoint );
  1137. /**
  1138. * Function GetPadFast
  1139. * return pad found at \a aPosition on \a aLayerMask using the fast search method.
  1140. * <p>
  1141. * The fast search method only works if the pad list has already been built.
  1142. * </p>
  1143. * @param aPosition A wxPoint object containing the position to hit test.
  1144. * @param aLayerMask A layer or layers to mask the hit test.
  1145. * @return A pointer to a D_PAD object if found or NULL if not found.
  1146. */
  1147. D_PAD* GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask );
  1148. /**
  1149. * Function GetPad
  1150. * locates the pad connected at \a aPosition on \a aLayer starting at list position
  1151. * \a aPad
  1152. * <p>
  1153. * This function uses a fast search in this sorted pad list and it is faster than
  1154. * GetPadFast(). This list is a sorted pad list must be built before calling this
  1155. * function.
  1156. * </p>
  1157. * @note The normal pad list is sorted by increasing netcodes.
  1158. * @param aPadList = the list of pads candidates (a std::vector<D_PAD*>)
  1159. * @param aPosition A wxPoint object containing the position to test.
  1160. * @param aLayerMask A layer or layers to mask the hit test.
  1161. * @return a D_PAD object pointer to the connected pad.
  1162. */
  1163. D_PAD* GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask );
  1164. /**
  1165. * Function GetSortedPadListByXthenYCoord
  1166. * first empties then fills the vector with all pads and sorts them by
  1167. * increasing x coordinate, and for increasing y coordinate for same values of x coordinates.
  1168. * The vector only holds pointers to the pads and
  1169. * those pointers are only references to pads which are owned by the BOARD
  1170. * through other links.
  1171. * @param aVector Where to put the pad pointers.
  1172. * @param aNetCode = the netcode filter:
  1173. * = -1 to build the full pad list.
  1174. * = a given netcode to build the pad list relative to the given net
  1175. */
  1176. void GetSortedPadListByXthenYCoord( std::vector<D_PAD*>& aVector, int aNetCode = -1 );
  1177. /**
  1178. * Function GetTrace
  1179. * find the segment of \a aTrace at \a aPosition on \a aLayer if \a Layer is visible.
  1180. * Traces that are flagged as deleted or busy are ignored.
  1181. *
  1182. * @param aTrace A pointer to the TRACK object to search.
  1183. * @param aPosition A wxPoint object containing the position to test.
  1184. * @param aLayerMask A layer or layers to mask the hit test. Use -1 to ignore
  1185. * layer mask.
  1186. * @return A TRACK object pointer if found otherwise NULL.
  1187. */
  1188. TRACK* GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask );
  1189. /**
  1190. * Function MarkTrace
  1191. * marks a chain of trace segments, connected to \a aTrace.
  1192. * <p>
  1193. * Each segment is marked by setting the BUSY bit into m_Flags. Electrical
  1194. * continuity is detected by walking each segment, and finally the segments
  1195. * are rearranged into a contiguous chain within the given list.
  1196. * </p>
  1197. *
  1198. * @param aTrace The segment within a list of trace segments to test.
  1199. * @param aCount A pointer to an integer where to return the number of
  1200. * marked segments.
  1201. * @param aTraceLength A pointer to an double where to return the length of the
  1202. * trace.
  1203. * @param aInPackageLength A pointer to an double where to return the extra lengths inside
  1204. * integrated circuits from the pads connected to this track to the
  1205. * die (if any).
  1206. * @param aReorder true for reorder the interesting segments (useful for
  1207. * track edition/deletion) in this case the flag BUSY is
  1208. * set (the user is responsible of flag clearing). False
  1209. * for no reorder : useful when we want just calculate the
  1210. * track length in this case, flags are reset
  1211. * @return TRACK* The first in the chain of interesting segments.
  1212. */
  1213. TRACK* MarkTrace( TRACK* aTrace, int* aCount, double* aTraceLength,
  1214. double* aInPackageLength, bool aReorder );
  1215. /**
  1216. * Function GetFootprint
  1217. * get a footprint by its bounding rectangle at \a aPosition on \a aLayer.
  1218. * <p>
  1219. * If more than one footprint is at \a aPosition, then the closest footprint on the
  1220. * active layer is returned. The distance is calculated via manhattan distance from
  1221. * the center of the bounding rectangle to \a aPosition.
  1222. *
  1223. * @param aPosition A wxPoint object containing the position to test.
  1224. * @param aActiveLayer Layer to test.
  1225. * @param aVisibleOnly Search only the visible layers if true.
  1226. * @param aIgnoreLocked Ignore locked modules when true.
  1227. * @return MODULE* The best module or NULL if none.
  1228. */
  1229. MODULE* GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer,
  1230. bool aVisibleOnly, bool aIgnoreLocked = false );
  1231. /**
  1232. * Function GetLockPoint
  1233. * returns the item at the "attachment" point at the end of a trace at \a aPosition
  1234. * on \a aLayerMask.
  1235. * <p>
  1236. * This may be a PAD or another trace segment.
  1237. * </p>
  1238. *
  1239. * @param aPosition A wxPoint object containing the position to test.
  1240. * @param aLayerMask A layer or layers to mask the hit test. Use -1 to ignore
  1241. * layer mask.
  1242. * @return A pointer to a BOARD_ITEM object if found otherwise NULL.
  1243. */
  1244. BOARD_CONNECTED_ITEM* GetLockPoint( const wxPoint& aPosition, LAYER_MSK aLayerMask );
  1245. /**
  1246. * Function CreateLockPoint
  1247. * creates an intermediate point on \a aSegment and break it into two segments
  1248. * at \a aPosition.
  1249. * <p>
  1250. * The new segment starts from \a aPosition and ends at the end point of \a
  1251. * aSegment. The original segment now ends at \a aPosition.
  1252. * </p>
  1253. *
  1254. * @param aPosition A wxPoint object containing the position to test and the new
  1255. * segment start position if the return value is not NULL.
  1256. * @param aSegment The trace segment to create the lock point on.
  1257. * @param aList The pick list to add the created items to.
  1258. * @return NULL if no new point was created or a pointer to a TRACK ojbect of the
  1259. * created segment. If \a aSegment points to a via the exact value of \a
  1260. * aPosition and a pointer to the via are returned.
  1261. */
  1262. TRACK* CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS_LIST* aList );
  1263. };
  1264. #endif // CLASS_BOARD_H_