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.

115 lines
3.3 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 <drc/drc_item.h>
  32. #include <marker_base.h>
  33. class DRC_ITEM;
  34. // Coordinates count for the basic shape marker
  35. #define MARKER_SHAPE_POINT_COUNT 9
  36. class MSG_PANEL_ITEM;
  37. class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE
  38. {
  39. public:
  40. MARKER_PCB( std::shared_ptr<RC_ITEM> aItem, const wxPoint& aPosition );
  41. ~MARKER_PCB();
  42. static inline bool ClassOf( const EDA_ITEM* aItem )
  43. {
  44. return aItem && PCB_MARKER_T == aItem->Type();
  45. }
  46. const KIID GetUUID() const override { return m_Uuid; }
  47. wxString Serialize() const;
  48. static MARKER_PCB* Deserialize( const wxString& data );
  49. void Move(const wxPoint& aMoveVector) override
  50. {
  51. m_Pos += aMoveVector;
  52. }
  53. void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
  54. void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
  55. wxPoint GetPosition() const override { return m_Pos; }
  56. void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
  57. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override
  58. {
  59. return HitTestMarker( aPosition, aAccuracy );
  60. }
  61. GAL_LAYER_ID GetColorLayer() const;
  62. void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
  63. bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override
  64. {
  65. return BOARD_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData );
  66. }
  67. wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
  68. BITMAP_DEF GetMenuImage() const override;
  69. const BOX2I ViewBBox() const override;
  70. const EDA_RECT GetBoundingBox() const override;
  71. void ViewGetLayers( int aLayers[], int& aCount ) const override;
  72. #if defined(DEBUG)
  73. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  74. #endif
  75. /** Get class name
  76. * @return string "MARKER_PCB"
  77. */
  78. virtual wxString GetClass() const override
  79. {
  80. return wxT( "MARKER_PCB" );
  81. }
  82. protected:
  83. KIGFX::COLOR4D getColor() const override;
  84. };
  85. #endif // CLASS_MARKER_PCB_H