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.

110 lines
3.4 KiB

14 years ago
14 years ago
14 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 1992-2020 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 PCB_TARGET_H
  25. #define PCB_TARGET_H
  26. #include <board_item.h>
  27. class EDA_RECT;
  28. class LINE_READER;
  29. class PCB_TARGET : public BOARD_ITEM
  30. {
  31. int m_shape; // bit 0 : 0 = draw +, 1 = draw X
  32. int m_size;
  33. int m_lineWidth;
  34. wxPoint m_pos;
  35. public:
  36. PCB_TARGET( BOARD_ITEM* aParent );
  37. // Do not create a copy constructor. The one generated by the compiler is adequate.
  38. PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
  39. const wxPoint& aPos, int aSize, int aWidth );
  40. // Do not create a copy constructor & operator=.
  41. // The ones generated by the compiler are adequate.
  42. ~PCB_TARGET();
  43. static inline bool ClassOf( const EDA_ITEM* aItem )
  44. {
  45. return aItem && PCB_TARGET_T == aItem->Type();
  46. }
  47. void SetPosition( const wxPoint& aPos ) override { m_pos = aPos; }
  48. wxPoint GetPosition() const override { return m_pos; }
  49. void SetShape( int aShape ) { m_shape = aShape; }
  50. int GetShape() const { return m_shape; }
  51. void SetSize( int aSize ) { m_size = aSize; }
  52. int GetSize() const { return m_size; }
  53. void SetWidth( int aWidth ) { m_lineWidth = aWidth; }
  54. int GetWidth() const { return m_lineWidth; }
  55. void Move( const wxPoint& aMoveVector ) override
  56. {
  57. m_pos += aMoveVector;
  58. }
  59. void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
  60. void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
  61. wxString GetClass() const override
  62. {
  63. return wxT( "PCB_TARGET" );
  64. }
  65. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
  66. bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
  67. // Virtual function
  68. const EDA_RECT GetBoundingBox() const override;
  69. std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer ) const override;
  70. wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
  71. BITMAP_DEF GetMenuImage() const override;
  72. EDA_ITEM* Clone() const override;
  73. virtual void SwapData( BOARD_ITEM* aImage ) override;
  74. void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
  75. #if defined(DEBUG)
  76. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  77. #endif
  78. };
  79. #endif