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.

135 lines
4.4 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009-2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
  5. * Copyright (C) 1992-2018 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_marker_pcb.h
  26. * @brief Markers used to show a drc problem on boards.
  27. */
  28. #ifndef CLASS_MARKER_PCB_H
  29. #define CLASS_MARKER_PCB_H
  30. #include <class_board_item.h>
  31. #include <marker_base.h>
  32. // Coordinates count for the basic shape marker
  33. #define MARKER_SHAPE_POINT_COUNT 9
  34. class MSG_PANEL_ITEM;
  35. class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE
  36. {
  37. public:
  38. MARKER_PCB( BOARD_ITEM* aParent );
  39. /**
  40. * Constructor
  41. * @param aErrorCode The categorizing identifier for an error
  42. * @param aMarkerPos The position of the MARKER_PCB on the BOARD
  43. * @param aItem The first of two objects
  44. * @param aPos The position of the first of two objects
  45. * @param bItem The second of the two conflicting objects
  46. * @param bPos The position of the second of two objects
  47. */
  48. MARKER_PCB( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos,
  49. BOARD_ITEM* aItem, const wxPoint& aPos,
  50. BOARD_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() );
  51. /**
  52. * Constructor
  53. * @param aErrorCode The categorizing identifier for an error
  54. * @param aMarkerPos The position of the MARKER_PCB on the BOARD
  55. * @param aText Text describing the first of two objects
  56. * @param aPos The position of the first of two objects
  57. * @param bText Text describing the second of the two conflicting objects
  58. * @param bPos The position of the second of two objects
  59. */
  60. MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
  61. const wxString& aText, const wxPoint& aPos,
  62. const wxString& bText = wxEmptyString, const wxPoint& bPos = wxPoint() );
  63. ~MARKER_PCB();
  64. static inline bool ClassOf( const EDA_ITEM* aItem )
  65. {
  66. return aItem && PCB_MARKER_T == aItem->Type();
  67. }
  68. void Move(const wxPoint& aMoveVector) override
  69. {
  70. m_Pos += aMoveVector;
  71. }
  72. void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
  73. void Flip( const wxPoint& aCentre ) override;
  74. void Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset = ZeroOffset ) override
  75. {
  76. PrintMarker( aDC, aOffset );
  77. }
  78. const wxPoint GetPosition() const override { return m_Pos; }
  79. void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
  80. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override
  81. {
  82. return HitTestMarker( aPosition, aAccuracy );
  83. }
  84. bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
  85. void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
  86. wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
  87. BITMAP_DEF GetMenuImage() const override;
  88. const BOX2I ViewBBox() const override;
  89. const EDA_RECT GetBoundingBox() const override;
  90. void ViewGetLayers( int aLayers[], int& aCount ) const override;
  91. #if defined(DEBUG)
  92. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  93. #endif
  94. /** Get class name
  95. * @return string "MARKER_PCB"
  96. */
  97. virtual wxString GetClass() const override
  98. {
  99. return wxT( "MARKER_PCB" );
  100. }
  101. protected:
  102. ///> Pointer to BOARD_ITEM that causes DRC error.
  103. const BOARD_ITEM* m_item;
  104. };
  105. #endif // CLASS_MARKER_PCB_H