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.

113 lines
3.4 KiB

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, jaen-pierre.charras@gipsa-lab.inpg.com
  5. * Copyright (C) 1992-2011 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_pcb_target.h
  26. * @brief PCB_TARGET class definition. (targets for photo plots).
  27. */
  28. #ifndef PCB_TARGET_H_
  29. #define PCB_TARGET_H_
  30. #include <class_board_item.h>
  31. class EDA_RECT;
  32. class LINE_READER;
  33. class PCB_TARGET : public BOARD_ITEM
  34. {
  35. int m_Shape; // bit 0 : 0 = draw +, 1 = draw X
  36. int m_Size;
  37. int m_Width;
  38. wxPoint m_Pos;
  39. public:
  40. PCB_TARGET( BOARD_ITEM* aParent );
  41. // Do not create a copy constructor. The one generated by the compiler is adequate.
  42. PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
  43. const wxPoint& aPos, int aSize, int aWidth );
  44. // Do not create a copy constructor & operator=.
  45. // The ones generated by the compiler are adequate.
  46. ~PCB_TARGET();
  47. static inline bool ClassOf( const EDA_ITEM* aItem )
  48. {
  49. return aItem && PCB_TARGET_T == aItem->Type();
  50. }
  51. void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
  52. const wxPoint GetPosition() const override { return m_Pos; }
  53. void SetShape( int aShape ) { m_Shape = aShape; }
  54. int GetShape() const { return m_Shape; }
  55. void SetSize( int aSize ) { m_Size = aSize; }
  56. int GetSize() const { return m_Size; }
  57. void SetWidth( int aWidth ) { m_Width = aWidth; }
  58. int GetWidth() const { return m_Width; }
  59. void Move( const wxPoint& aMoveVector ) override
  60. {
  61. m_Pos += aMoveVector;
  62. }
  63. void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
  64. void Flip( const wxPoint& aCentre ) override;
  65. void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override;
  66. wxString GetClass() const override
  67. {
  68. return wxT( "PCB_TARGET" );
  69. }
  70. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
  71. bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
  72. // Virtual function
  73. const EDA_RECT GetBoundingBox() const override;
  74. wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
  75. BITMAP_DEF GetMenuImage() const override;
  76. EDA_ITEM* Clone() const override;
  77. virtual void SwapData( BOARD_ITEM* aImage ) override;
  78. #if defined(DEBUG)
  79. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  80. #endif
  81. };
  82. #endif