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.

111 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-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 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. public:
  32. PCB_TARGET( BOARD_ITEM* aParent );
  33. // Do not create a copy constructor. The one generated by the compiler is adequate.
  34. PCB_TARGET( BOARD_ITEM* aParent, int aShape, PCB_LAYER_ID aLayer,
  35. const wxPoint& aPos, int aSize, int aWidth );
  36. // Do not create a copy constructor & operator=.
  37. // The ones generated by the compiler are adequate.
  38. ~PCB_TARGET();
  39. static inline bool ClassOf( const EDA_ITEM* aItem )
  40. {
  41. return aItem && PCB_TARGET_T == aItem->Type();
  42. }
  43. void SetPosition( const wxPoint& aPos ) override { m_pos = aPos; }
  44. wxPoint GetPosition() const override { return m_pos; }
  45. void SetShape( int aShape ) { m_shape = aShape; }
  46. int GetShape() const { return m_shape; }
  47. void SetSize( int aSize ) { m_size = aSize; }
  48. int GetSize() const { return m_size; }
  49. void SetWidth( int aWidth ) { m_lineWidth = aWidth; }
  50. int GetWidth() const { return m_lineWidth; }
  51. void Move( const wxPoint& aMoveVector ) override
  52. {
  53. m_pos += aMoveVector;
  54. }
  55. void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
  56. void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
  57. wxString GetClass() const override
  58. {
  59. return wxT( "PCB_TARGET" );
  60. }
  61. bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
  62. bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
  63. // Virtual function
  64. const EDA_RECT GetBoundingBox() const override;
  65. std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer ) const override;
  66. wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
  67. BITMAPS GetMenuImage() const override;
  68. EDA_ITEM* Clone() const override;
  69. virtual void SwapData( BOARD_ITEM* aImage ) override;
  70. void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
  71. #if defined(DEBUG)
  72. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  73. #endif
  74. private:
  75. int m_shape; // bit 0 : 0 = draw +, 1 = draw X
  76. int m_size;
  77. int m_lineWidth;
  78. wxPoint m_pos;
  79. };
  80. #endif