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.

119 lines
3.8 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-2019 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( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
  49. void Plot( PLOTTER* aPlotter ) 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. (void) aPlotter;
  55. }
  56. EDA_RECT const GetBoundingBox() const override;
  57. // Geometric transforms (used in block operations):
  58. void Move( const wxPoint& aMoveVector ) override
  59. {
  60. m_Pos += aMoveVector;
  61. }
  62. void MirrorY( int aYaxis_position ) override;
  63. void MirrorX( int aXaxis_position ) override;
  64. void Rotate( wxPoint aPosition ) override;
  65. /**
  66. * Compare DRC marker main and auxiliary text against search string.
  67. *
  68. * @param aSearchData - Criteria to search against.
  69. * @param aAuxData A pointer to optional data required for the search or NULL
  70. * if not used.
  71. * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
  72. * @return True if the DRC main or auxiliary text matches the search criteria.
  73. */
  74. bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override;
  75. void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
  76. wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
  77. {
  78. return wxString( _( "ERC Marker" ) );
  79. }
  80. BITMAP_DEF GetMenuImage() const override;
  81. wxPoint GetPosition() const override { return m_Pos; }
  82. void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; }
  83. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
  84. EDA_ITEM* Clone() const override;
  85. #if defined(DEBUG)
  86. void Show( int nestLevel, std::ostream& os ) const override;
  87. #endif
  88. protected:
  89. KIGFX::COLOR4D getColor() const override;
  90. };
  91. #endif // TYPE_SCH_MARKER_H_