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.

149 lines
5.0 KiB

14 years ago
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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
  6. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file class_edge_mod.h
  27. * @brief EDGE_MODULE class definition.
  28. */
  29. #ifndef CLASS_EDGE_MOD_H_
  30. #define CLASS_EDGE_MOD_H_
  31. #include <wx/gdicmn.h>
  32. #include <class_drawsegment.h>
  33. class LINE_READER;
  34. class MSG_PANEL_ITEM;
  35. class EDGE_MODULE : public DRAWSEGMENT
  36. {
  37. public:
  38. EDGE_MODULE( MODULE* parent, STROKE_T aShape = S_SEGMENT );
  39. // Do not create a copy constructor & operator=.
  40. // The ones generated by the compiler are adequate.
  41. ~EDGE_MODULE();
  42. static inline bool ClassOf( const EDA_ITEM* aItem )
  43. {
  44. return aItem && PCB_MODULE_EDGE_T == aItem->Type();
  45. }
  46. /**
  47. * Move an edge of the footprint.
  48. * This is a footprint shape modification.
  49. * (should be only called by a footprint editing function)
  50. */
  51. void Move( const wxPoint& aMoveVector ) override;
  52. /**
  53. * Mirror an edge of the footprint.
  54. * Do not change the layer
  55. * This is a footprint shape modification.
  56. * (should be only called by a footprint editing function)
  57. */
  58. void Mirror( const wxPoint aCentre, bool aMirrorAroundXAxis );
  59. /**
  60. * Rotate an edge of the footprint.
  61. * This is a footprint shape modification.
  62. * (should be only called by a footprint editing function )
  63. */
  64. void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
  65. /**
  66. * Flip entity relative to aCentre.
  67. * The item is mirrored, and layer changed to the paired corresponding layer
  68. * if it is on a paired layer
  69. * This function should be called only from MODULE::Flip because there is
  70. * not usual to flip an item alone, without flipping the parent footprint.
  71. * (consider Mirror for a mirror transform).
  72. */
  73. void Flip( const wxPoint& aCentre ) override;
  74. bool IsParentFlipped() const;
  75. void SetStart0( const wxPoint& aPoint ) { m_Start0 = aPoint; }
  76. const wxPoint& GetStart0() const { return m_Start0; }
  77. void SetEnd0( const wxPoint& aPoint ) { m_End0 = aPoint; }
  78. const wxPoint& GetEnd0() const { return m_End0; }
  79. void SetBezier0_C1( const wxPoint& aPoint ) { m_Bezier0_C1 = aPoint; }
  80. const wxPoint& GetBezier0_C1() const { return m_Bezier0_C1; }
  81. void SetBezier0_C2( const wxPoint& aPoint ) { m_Bezier0_C2 = aPoint; }
  82. const wxPoint& GetBezier0_C2() const { return m_Bezier0_C2; }
  83. /**
  84. * Set relative coordinates from draw coordinates.
  85. * Call in only when the geometry ov the footprint is modified
  86. * and therefore the relative coordinates have to be updated from
  87. * the draw coordinates
  88. */
  89. void SetLocalCoord();
  90. /**
  91. * Set draw coordinates (absolute values ) from relative coordinates.
  92. * Must be called when a relative coordinate has changed, in order
  93. * to see the changes on screen
  94. */
  95. void SetDrawCoord();
  96. /* drawing functions */
  97. void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
  98. GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override;
  99. void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
  100. wxString GetClass() const override
  101. {
  102. return wxT( "MGRAPHIC" );
  103. }
  104. wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
  105. BITMAP_DEF GetMenuImage() const override;
  106. EDA_ITEM* Clone() const override;
  107. virtual unsigned int ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
  108. #if defined(DEBUG)
  109. void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
  110. #endif
  111. wxPoint m_Start0; ///< Start point or center, relative to module origin, orient 0.
  112. wxPoint m_End0; ///< End point, relative to module origin, orient 0.
  113. wxPoint m_Bezier0_C1; ///< Bezier Control Point 1, relative to module origin, orient 0.
  114. wxPoint m_Bezier0_C2; ///< Bezier Control Point 2, relative to module origin, orient 0.
  115. };
  116. #endif // CLASS_EDGE_MOD_H_