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.

116 lines
3.7 KiB

7 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2004-2021 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. #ifndef TYPE_SCH_MARKER_H_
  25. #define TYPE_SCH_MARKER_H_
  26. #include <erc_item.h>
  27. #include <sch_item.h>
  28. #include <marker_base.h>
  29. class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
  30. {
  31. public:
  32. SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const wxPoint& aPos );
  33. // Do not create a copy constructor. The one generated by the compiler is adequate.
  34. static inline bool ClassOf( const EDA_ITEM* aItem )
  35. {
  36. return aItem && SCH_MARKER_T == aItem->Type();
  37. }
  38. wxString GetClass() const override
  39. {
  40. return wxT( "SCH_MARKER" );
  41. }
  42. const KIID GetUUID() const override { return m_Uuid; }
  43. void SwapData( SCH_ITEM* aItem ) override;
  44. wxString Serialize() const;
  45. static SCH_MARKER* Deserialize( const wxString& data );
  46. void ViewGetLayers( int aLayers[], int& aCount ) const override;
  47. SCH_LAYER_ID GetColorLayer() const;
  48. void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
  49. void Plot( PLOTTER* /* aPlotter */ ) const override
  50. {
  51. // SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an
  52. // assertion if we do not confirm this by locally implementing a no-op
  53. // Plot().
  54. }
  55. EDA_RECT const GetBoundingBox() const override;
  56. // Geometric transforms (used in block operations):
  57. void Move( const wxPoint& aMoveVector ) override
  58. {
  59. m_Pos += aMoveVector;
  60. }
  61. void MirrorHorizontally( int aCenter ) override;
  62. void MirrorVertically( int aCenter ) override;
  63. void Rotate( const wxPoint& aCenter ) override;
  64. /**
  65. * Compare DRC marker main and auxiliary text against search string.
  66. *
  67. * @param[in] aSearchData is the criteria to search against.
  68. * @param[in] aAuxData is the optional data required for the search or NULL if not used.
  69. * @return True if the DRC main or auxiliary text matches the search criteria.
  70. */
  71. bool Matches( const wxFindReplaceData& aSearchData, void* aAuxDat ) const override;
  72. void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
  73. wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
  74. {
  75. return wxString( _( "ERC Marker" ) );
  76. }
  77. BITMAPS GetMenuImage() const override;
  78. wxPoint GetPosition() const override { return m_Pos; }
  79. void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; }
  80. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
  81. EDA_ITEM* Clone() const override;
  82. #if defined(DEBUG)
  83. void Show( int nestLevel, std::ostream& os ) const override;
  84. #endif
  85. protected:
  86. KIGFX::COLOR4D getColor() const override;
  87. };
  88. #endif // TYPE_SCH_MARKER_H_