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.

114 lines
3.5 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 EDA_DRAW_PANEL;
  34. class PCB_TARGET : public BOARD_ITEM
  35. {
  36. int m_Shape; // bit 0 : 0 = draw +, 1 = draw X
  37. int m_Size;
  38. int m_Width;
  39. wxPoint m_Pos;
  40. public:
  41. PCB_TARGET( BOARD_ITEM* aParent );
  42. // Do not create a copy constructor. The one generated by the compiler is adequate.
  43. PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
  44. const wxPoint& aPos, int aSize, int aWidth );
  45. // Do not create a copy constructor & operator=.
  46. // The ones generated by the compiler are adequate.
  47. ~PCB_TARGET();
  48. void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; }
  49. const wxPoint GetPosition() const override { return m_Pos; }
  50. void SetShape( int aShape ) { m_Shape = aShape; }
  51. int GetShape() const { return m_Shape; }
  52. void SetSize( int aSize ) { m_Size = aSize; }
  53. int GetSize() const { return m_Size; }
  54. void SetWidth( int aWidth ) { m_Width = aWidth; }
  55. int GetWidth() const { return m_Width; }
  56. void Move( const wxPoint& aMoveVector ) override
  57. {
  58. m_Pos += aMoveVector;
  59. }
  60. void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
  61. void Flip( const wxPoint& aCentre ) override;
  62. void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
  63. GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
  64. bool HitTest( const wxPoint& aPosition ) const override;
  65. wxString GetClass() const override
  66. {
  67. return wxT( "PCB_TARGET" );
  68. }
  69. /** @copydoc BOARD_ITEM::HitTest(const EDA_RECT& aRect,
  70. * bool aContained = true, int aAccuracy ) const
  71. */
  72. bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
  73. // Virtual function
  74. const EDA_RECT GetBoundingBox() const override;
  75. wxString GetSelectMenuText() const override;
  76. BITMAP_DEF GetMenuImage() const override;
  77. EDA_ITEM* Clone() const override;
  78. virtual void SwapData( BOARD_ITEM* aImage ) override;
  79. #if defined(DEBUG)
  80. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  81. #endif
  82. };
  83. #endif