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.

160 lines
6.0 KiB

14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
8 years ago
14 years ago
14 years ago
14 years ago
14 years ago
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) 2008-2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
  5. * Copyright (C) 1992-2018 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_zone_settings.h
  26. * @brief Class ZONE_SETTINGS used to handle zones parameters in dialogs.
  27. */
  28. #ifndef ZONE_SETTINGS_H_
  29. #define ZONE_SETTINGS_H_
  30. #include <layers_id_colors_and_visibility.h>
  31. #include <zones.h>
  32. #include <wx/dataview.h>
  33. enum ZONE_FILL_MODE
  34. {
  35. ZFM_POLYGONS = 0, // fill zone with polygons
  36. ZFM_HATCH_PATTERN = 1 // fill zone using a grid pattern
  37. };
  38. /**
  39. * Class ZONE_SETTINGS
  40. * handles zones parameters.
  41. * Because a zone can be on copper or non copper layers, and can be also
  42. * a keepout area, some parameters are irrelevant depending on the type of zone
  43. */
  44. class ZONE_SETTINGS
  45. {
  46. public:
  47. enum {
  48. SMOOTHING_UNDEFINED = -1,
  49. SMOOTHING_NONE = 0,
  50. SMOOTHING_CHAMFER,
  51. SMOOTHING_FILLET,
  52. SMOOTHING_LAST
  53. };
  54. ZONE_FILL_MODE m_FillMode;
  55. int m_ZonePriority; ///< Priority (0 ... N) of the zone
  56. int m_ZoneClearance; ///< Clearance value
  57. int m_ZoneMinThickness; ///< Min thickness value in filled areas
  58. int m_HatchFillTypeThickness; ///< Grid style shape: thickness of lines (if 0 -> solid shape)
  59. int m_HatchFillTypeGap; ///< Grid style shape: clearance between lines (0 -> solid shape)
  60. double m_HatchFillTypeOrientation; ///< Grid style shape: orientation of grid lines in degrees
  61. int m_HatchFillTypeSmoothingLevel; ///< Grid pattern smoothing type, similar to corner smoothing type
  62. ///< 0 = no smoothing, 1 = fillet, >= 2 = arc
  63. double m_HatchFillTypeSmoothingValue; ///< Grid pattern chamfer distance/fillet value
  64. ///< this is the ratio between the gap and the chamfer size
  65. int m_NetcodeSelection; ///< Net code selection for the current zone
  66. LSET m_Layers;
  67. PCB_LAYER_ID m_CurrentZone_Layer; ///< Layer used to create the current zone
  68. /// Option to show the zone area (outlines only, short hatches or full hatches
  69. int m_Zone_HatchingStyle;
  70. long m_ThermalReliefGap; ///< thickness of the gap in thermal reliefs
  71. long m_ThermalReliefCopperBridge; ///< thickness of the copper bridge in thermal reliefs
  72. bool m_Zone_45_Only;
  73. private:
  74. int m_cornerSmoothingType; ///< Corner smoothing type
  75. unsigned int m_cornerRadius; ///< Corner chamfer distance / fillet radius
  76. ZoneConnection m_PadConnection;
  77. /* A zone outline can be a keepout zone.
  78. * It will be never filled, and DRC should test for pads, tracks and vias
  79. */
  80. bool m_isKeepout;
  81. /* For keepout zones only:
  82. * what is not allowed inside the keepout ( pads, tracks and vias )
  83. */
  84. bool m_keepoutDoNotAllowCopperPour;
  85. bool m_keepoutDoNotAllowVias;
  86. bool m_keepoutDoNotAllowTracks;
  87. public:
  88. ZONE_SETTINGS();
  89. /**
  90. * operator << ( const ZONE_CONTAINER& )
  91. * was Function ImportSetting
  92. * copies settings from a given zone into this object.
  93. * @param aSource: the given zone
  94. */
  95. ZONE_SETTINGS& operator << ( const ZONE_CONTAINER& aSource );
  96. /**
  97. * A helper routine for the various zone dialogs (copper, non-copper, keepout).
  98. * @param aShowCopper indicates whether copper or technical layers should be shown
  99. */
  100. void SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame, bool aShowCopper );
  101. /**
  102. * Function ExportSetting
  103. * copy settings to a given zone
  104. * @param aTarget: the given zone
  105. * @param aFullExport: if false: some parameters are NOT exported
  106. * because they must not be exported when export settings from a zone to others zones
  107. * Currently:
  108. * m_NetcodeSelection
  109. */
  110. void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true ) const;
  111. void SetCornerSmoothingType( int aType) { m_cornerSmoothingType = aType; }
  112. int GetCornerSmoothingType() const { return m_cornerSmoothingType; }
  113. void SetCornerRadius( int aRadius );
  114. unsigned int GetCornerRadius() const { return m_cornerRadius; }
  115. ZoneConnection GetPadConnection() const { return m_PadConnection; }
  116. void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
  117. /**
  118. * Accessors to parameters used in Keepout zones:
  119. */
  120. const bool GetIsKeepout() const { return m_isKeepout; }
  121. const bool GetDoNotAllowCopperPour() const { return m_keepoutDoNotAllowCopperPour; }
  122. const bool GetDoNotAllowVias() const { return m_keepoutDoNotAllowVias; }
  123. const bool GetDoNotAllowTracks() const { return m_keepoutDoNotAllowTracks; }
  124. void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
  125. void SetDoNotAllowCopperPour( bool aEnable ) { m_keepoutDoNotAllowCopperPour = aEnable; }
  126. void SetDoNotAllowVias( bool aEnable ) { m_keepoutDoNotAllowVias = aEnable; }
  127. void SetDoNotAllowTracks( bool aEnable ) { m_keepoutDoNotAllowTracks = aEnable; }
  128. };
  129. #endif // ZONE_SETTINGS_H_