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.

210 lines
8.2 KiB

14 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
14 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
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-2022 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 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 <layer_ids.h>
  31. #include <zones.h>
  32. #include <geometry/eda_angle.h>
  33. #include <teardrop/teardrop_types.h>
  34. class wxDataViewListCtrl;
  35. enum class ZONE_FILL_MODE
  36. {
  37. POLYGONS = 0, // fill zone with polygons
  38. HATCH_PATTERN = 1 // fill zone using a grid pattern
  39. };
  40. /// Zone border styles
  41. enum class ZONE_BORDER_DISPLAY_STYLE
  42. {
  43. NO_HATCH,
  44. DIAGONAL_FULL,
  45. DIAGONAL_EDGE,
  46. INVISIBLE_BORDER // Disable outline drawing for very special cases
  47. };
  48. /// Whether or not to remove isolated islands from a zone
  49. enum class ISLAND_REMOVAL_MODE
  50. {
  51. ALWAYS = 0,
  52. NEVER,
  53. AREA
  54. };
  55. /**
  56. * ZONE_SETTINGS
  57. * handles zones parameters.
  58. * Because a zone can be on copper or non copper layers, and can be also
  59. * a keepout area, some parameters are irrelevant depending on the type of zone
  60. */
  61. class ZONE_SETTINGS
  62. {
  63. public:
  64. // the actual zone outline shape can be slightly modified (smoothed):
  65. enum {
  66. SMOOTHING_UNDEFINED = -1,
  67. SMOOTHING_NONE = 0, // Zone outline is used without change
  68. SMOOTHING_CHAMFER, // Zone outline is used after chamfering corners
  69. SMOOTHING_FILLET, // Zone outline is used after rounding corners
  70. SMOOTHING_LAST // sentinel
  71. };
  72. unsigned m_ZonePriority; // Priority (0 ... N) of the zone
  73. ZONE_FILL_MODE m_FillMode;
  74. int m_ZoneClearance; // Minimal clearance value
  75. int m_ZoneMinThickness; // Min thickness value in filled areas
  76. int m_HatchThickness; // HatchBorder thickness of lines (if 0 -> solid shape)
  77. int m_HatchGap; // HatchBorder clearance between lines (0 -> solid shape)
  78. EDA_ANGLE m_HatchOrientation; // HatchBorder orientation of grid lines
  79. int m_HatchSmoothingLevel; // HatchBorder smoothing type, similar to corner smoothing type
  80. // 0 = no smoothing, 1 = fillet, >= 2 = arc
  81. double m_HatchSmoothingValue; // HatchBorder chamfer/fillet size as a ratio of hole size
  82. double m_HatchHoleMinArea; // min size before holes are dropped (ratio)
  83. int m_HatchBorderAlgorithm; // 0 = use min zone thickness
  84. int m_NetcodeSelection; // Net code selection for the current zone
  85. wxString m_Name; // Unique name for the current zone (can be blank)
  86. LSET m_Layers; // Layers that this zone exists on
  87. /// Option to show the zone area (outlines only, short hatches or full hatches
  88. ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle;
  89. int m_BorderHatchPitch; // for hatched outlines: dist between 2 hatches
  90. long m_ThermalReliefGap; // thickness of the gap in thermal reliefs
  91. long m_ThermalReliefSpokeWidth; // thickness of the copper bridge in thermal reliefs
  92. bool m_Locked;
  93. /* A zone outline can be a teardrop zone with different rules
  94. * priority, smoothed corners, thermal relief...
  95. */
  96. TEARDROP_TYPE m_TeardropType;
  97. private:
  98. int m_cornerSmoothingType; // Corner smoothing type
  99. unsigned int m_cornerRadius; // Corner chamfer distance / fillet radius
  100. ZONE_CONNECTION m_padConnection;
  101. /*
  102. * Keepout zones and keepout flags.
  103. * Note that DRC rules can set keepouts on zones whether they're a keepout or not.
  104. */
  105. bool m_isRuleArea;
  106. bool m_keepoutDoNotAllowCopperPour;
  107. bool m_keepoutDoNotAllowVias;
  108. bool m_keepoutDoNotAllowTracks;
  109. bool m_keepoutDoNotAllowPads;
  110. bool m_keepoutDoNotAllowFootprints;
  111. ISLAND_REMOVAL_MODE m_removeIslands;
  112. long long int m_minIslandArea;
  113. public:
  114. ZONE_SETTINGS();
  115. bool operator==( const ZONE_SETTINGS& aOther ) const;
  116. bool operator!=( const ZONE_SETTINGS& aOther ) const { return !operator==( aOther ); }
  117. /**
  118. * operator << ( const ZONE& )
  119. * was Function ImportSetting
  120. * copies settings from a given zone into this object.
  121. * @param aSource: the given zone
  122. */
  123. ZONE_SETTINGS& operator << ( const ZONE& aSource );
  124. /**
  125. * @return Default ZONE_SETTINGS
  126. */
  127. static const ZONE_SETTINGS& GetDefaultSettings();
  128. /**
  129. * A helper routine for the various zone dialogs (copper, non-copper, keepout).
  130. * @param aList the wxDataViewListCtrl to populate
  131. * @param aFrame the parent editor frame
  132. * @param aFpEditorMode true to show a single "Inner Layers" item for all inner copper layers
  133. */
  134. void SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame, LSET aLayers,
  135. bool aFpEditorMode );
  136. /**
  137. * Function ExportSetting
  138. * copy settings to a given zone
  139. * @param aTarget: the given zone
  140. * @param aFullExport: if false: some parameters are NOT exported
  141. * because they must not be exported when export settings from a zone to others zones
  142. * Currently:
  143. * m_NetcodeSelection
  144. */
  145. void ExportSetting( ZONE& aTarget, bool aFullExport = true ) const;
  146. void SetCornerSmoothingType( int aType) { m_cornerSmoothingType = aType; }
  147. int GetCornerSmoothingType() const { return m_cornerSmoothingType; }
  148. void SetCornerRadius( int aRadius );
  149. unsigned int GetCornerRadius() const { return m_cornerRadius; }
  150. ZONE_CONNECTION GetPadConnection() const { return m_padConnection; }
  151. void SetPadConnection( ZONE_CONNECTION aPadConnection ) { m_padConnection = aPadConnection; }
  152. /**
  153. * Accessors to parameters used in Rule Area zones:
  154. */
  155. bool GetIsRuleArea() const { return m_isRuleArea; }
  156. bool GetDoNotAllowCopperPour() const { return m_keepoutDoNotAllowCopperPour; }
  157. bool GetDoNotAllowVias() const { return m_keepoutDoNotAllowVias; }
  158. bool GetDoNotAllowTracks() const { return m_keepoutDoNotAllowTracks; }
  159. bool GetDoNotAllowPads() const { return m_keepoutDoNotAllowPads; }
  160. bool GetDoNotAllowFootprints() const { return m_keepoutDoNotAllowFootprints; }
  161. void SetIsRuleArea( bool aEnable ) { m_isRuleArea = aEnable; }
  162. void SetDoNotAllowCopperPour( bool aEnable ) { m_keepoutDoNotAllowCopperPour = aEnable; }
  163. void SetDoNotAllowVias( bool aEnable ) { m_keepoutDoNotAllowVias = aEnable; }
  164. void SetDoNotAllowTracks( bool aEnable ) { m_keepoutDoNotAllowTracks = aEnable; }
  165. void SetDoNotAllowPads( bool aEnable ) { m_keepoutDoNotAllowPads = aEnable; }
  166. void SetDoNotAllowFootprints( bool aEnable ) { m_keepoutDoNotAllowFootprints = aEnable; }
  167. ISLAND_REMOVAL_MODE GetIslandRemovalMode() const { return m_removeIslands; }
  168. void SetIslandRemovalMode( ISLAND_REMOVAL_MODE aRemove ) { m_removeIslands = aRemove; }
  169. long long int GetMinIslandArea() const { return m_minIslandArea; }
  170. void SetMinIslandArea( long long int aArea ) { m_minIslandArea = aArea; }
  171. };
  172. #endif // ZONE_SETTINGS_H_