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.

133 lines
3.7 KiB

18 years ago
18 years ago
  1. /*****************************/
  2. /* COTATION class definition */
  3. /*****************************/
  4. #ifndef COTATION_H
  5. #define COTATION_H
  6. #include "base_struct.h"
  7. class COTATION : public BOARD_ITEM
  8. {
  9. public:
  10. int m_Width;
  11. wxPoint m_Pos;
  12. int m_Shape;
  13. int m_Unit; /* 0 = inches, 1 = mm */
  14. int m_Value; /* value of PCB dimensions. */
  15. TEXTE_PCB* m_Text;
  16. int Barre_ox, Barre_oy, Barre_fx, Barre_fy;
  17. int TraitG_ox, TraitG_oy, TraitG_fx, TraitG_fy;
  18. int TraitD_ox, TraitD_oy, TraitD_fx, TraitD_fy;
  19. int FlecheD1_ox, FlecheD1_oy, FlecheD1_fx, FlecheD1_fy;
  20. int FlecheD2_ox, FlecheD2_oy, FlecheD2_fx, FlecheD2_fy;
  21. int FlecheG1_ox, FlecheG1_oy, FlecheG1_fx, FlecheG1_fy;
  22. int FlecheG2_ox, FlecheG2_oy, FlecheG2_fx, FlecheG2_fy;
  23. public:
  24. COTATION( BOARD_ITEM* aParent );
  25. ~COTATION();
  26. COTATION* Next() const { return (COTATION*) Pnext; }
  27. COTATION* Back() const { return (COTATION*) Pback; }
  28. wxPoint& GetPosition()
  29. {
  30. return m_Pos;
  31. }
  32. /**
  33. * Function SetLayer
  34. * sets the layer this item is on.
  35. * @param aLayer The layer number.
  36. */
  37. void SetLayer( int aLayer );
  38. bool ReadCotationDescr( FILE* File, int* LineNum );
  39. /**
  40. * Function Save
  41. * writes the data structures for this object out to a FILE in "*.brd" format.
  42. * @param aFile The FILE to write to.
  43. * @return bool - true if success writing else false.
  44. */
  45. bool Save( FILE* aFile ) const;
  46. void SetText( const wxString& NewText );
  47. wxString GetText( void );
  48. void Copy( COTATION* source );
  49. void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
  50. int aColorMode, const wxPoint& offset = ZeroOffset );
  51. /**
  52. * Function Move
  53. * @param offset : moving vector
  54. */
  55. void Move(const wxPoint& offset);
  56. /**
  57. * Function Rotate
  58. * Rotate this object.
  59. * @param const wxPoint& aRotCentre - the rotation point.
  60. * @param aAngle - the rotation angle in 0.1 degree.
  61. */
  62. virtual void Rotate(const wxPoint& aRotCentre, int aAngle);
  63. /**
  64. * Function Flip
  65. * Flip this object, i.e. change the board side for this object
  66. * @param const wxPoint& aCentre - the rotation point.
  67. */
  68. virtual void Flip(const wxPoint& aCentre );
  69. /**
  70. * Function Mirror
  71. * Mirror the Dimension , relative to a given horizontal axis
  72. * the text is not mirrored. only its position (and angle) is mirrored
  73. * the layer is not changed
  74. * @param axis_pos : vertical axis position
  75. */
  76. void Mirror(const wxPoint& axis_pos);
  77. /**
  78. * Function DisplayInfo
  79. * has knowledge about the frame and how and where to put status information
  80. * about this object into the frame's message panel.
  81. * Is virtual from EDA_BaseStruct.
  82. * @param frame A WinEDA_DrawFrame in which to print status information.
  83. */
  84. void DisplayInfo( WinEDA_DrawFrame* frame );
  85. /**
  86. * Function HitTest
  87. * tests if the given wxPoint is within the bounds of this object.
  88. * @param ref_pos A wxPoint to test
  89. * @return bool - true if a hit, else false
  90. */
  91. bool HitTest( const wxPoint& ref_pos );
  92. /**
  93. * Function HitTest (overlaid)
  94. * tests if the given EDA_Rect intersect this object.
  95. * For now, the anchor must be inside this rect.
  96. * @param refArea : the given EDA_Rect
  97. * @return bool - true if a hit, else false
  98. */
  99. bool HitTest( EDA_Rect& refArea );
  100. /**
  101. * Function GetClass
  102. * returns the class name.
  103. * @return wxString
  104. */
  105. wxString GetClass() const
  106. {
  107. return wxT( "DIMENSION" );
  108. }
  109. };
  110. #endif // #define COTATION_H