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.

201 lines
7.9 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
  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 <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. };
  47. /// Whether or not to remove isolated islands from a zone
  48. enum class ISLAND_REMOVAL_MODE
  49. {
  50. ALWAYS,
  51. NEVER,
  52. AREA
  53. };
  54. /**
  55. * ZONE_SETTINGS
  56. * handles zones parameters.
  57. * Because a zone can be on copper or non copper layers, and can be also
  58. * a keepout area, some parameters are irrelevant depending on the type of zone
  59. */
  60. class ZONE_SETTINGS
  61. {
  62. public:
  63. // the actual zone outline shape can be slightly modified (smoothed):
  64. enum {
  65. SMOOTHING_UNDEFINED = -1,
  66. SMOOTHING_NONE = 0, // Zone outline is used without change
  67. SMOOTHING_CHAMFER, // Zone outline is used after chamfering corners
  68. SMOOTHING_FILLET, // Zone outline is used after rounding corners
  69. SMOOTHING_LAST // sentinel
  70. };
  71. int m_ZonePriority; // Priority (0 ... N) of the zone
  72. ZONE_FILL_MODE m_FillMode;
  73. int m_ZoneClearance; // Minimal clearance value
  74. int m_ZoneMinThickness; // Min thickness value in filled areas
  75. int m_HatchThickness; // HatchBorder thickness of lines (if 0 -> solid shape)
  76. int m_HatchGap; // HatchBorder clearance between lines (0 -> solid shape)
  77. EDA_ANGLE m_HatchOrientation; // HatchBorder orientation of grid lines
  78. int m_HatchSmoothingLevel; // HatchBorder smoothing type, similar to corner smoothing type
  79. // 0 = no smoothing, 1 = fillet, >= 2 = arc
  80. double m_HatchSmoothingValue; // HatchBorder chamfer/fillet size as a ratio of hole size
  81. double m_HatchHoleMinArea; // min size before holes are dropped (ratio)
  82. int m_HatchBorderAlgorithm; // 0 = use min zone thickness
  83. int m_NetcodeSelection; // Net code selection for the current zone
  84. wxString m_Name; // Unique name for the current zone (can be blank)
  85. LSET m_Layers; // Layers that this zone exists on
  86. /// Option to show the zone area (outlines only, short hatches or full hatches
  87. ZONE_BORDER_DISPLAY_STYLE m_ZoneBorderDisplayStyle;
  88. int m_BorderHatchPitch; // for hatched outlines: dist between 2 hatches
  89. long m_ThermalReliefGap; // thickness of the gap in thermal reliefs
  90. long m_ThermalReliefSpokeWidth; // thickness of the copper bridge in thermal reliefs
  91. bool m_Zone_45_Only;
  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. /**
  116. * operator << ( const ZONE& )
  117. * was Function ImportSetting
  118. * copies settings from a given zone into this object.
  119. * @param aSource: the given zone
  120. */
  121. ZONE_SETTINGS& operator << ( const ZONE& aSource );
  122. /**
  123. * A helper routine for the various zone dialogs (copper, non-copper, keepout).
  124. * @param aList the wxDataViewListCtrl to populate
  125. * @param aFrame the parent editor frame
  126. * @param aFpEditorMode true to show a single "Inner Layers" item for all inner copper layers
  127. */
  128. void SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame, LSET aLayers,
  129. bool aFpEditorMode );
  130. /**
  131. * Function ExportSetting
  132. * copy settings to a given zone
  133. * @param aTarget: the given zone
  134. * @param aFullExport: if false: some parameters are NOT exported
  135. * because they must not be exported when export settings from a zone to others zones
  136. * Currently:
  137. * m_NetcodeSelection
  138. */
  139. void ExportSetting( ZONE& aTarget, bool aFullExport = true ) const;
  140. void SetCornerSmoothingType( int aType) { m_cornerSmoothingType = aType; }
  141. int GetCornerSmoothingType() const { return m_cornerSmoothingType; }
  142. void SetCornerRadius( int aRadius );
  143. unsigned int GetCornerRadius() const { return m_cornerRadius; }
  144. ZONE_CONNECTION GetPadConnection() const { return m_padConnection; }
  145. void SetPadConnection( ZONE_CONNECTION aPadConnection ) { m_padConnection = aPadConnection; }
  146. /**
  147. * Accessors to parameters used in Rule Area zones:
  148. */
  149. const bool GetIsRuleArea() const { return m_isRuleArea; }
  150. const bool GetDoNotAllowCopperPour() const { return m_keepoutDoNotAllowCopperPour; }
  151. const bool GetDoNotAllowVias() const { return m_keepoutDoNotAllowVias; }
  152. const bool GetDoNotAllowTracks() const { return m_keepoutDoNotAllowTracks; }
  153. const bool GetDoNotAllowPads() const { return m_keepoutDoNotAllowPads; }
  154. const bool GetDoNotAllowFootprints() const { return m_keepoutDoNotAllowFootprints; }
  155. void SetIsRuleArea( bool aEnable ) { m_isRuleArea = aEnable; }
  156. void SetDoNotAllowCopperPour( bool aEnable ) { m_keepoutDoNotAllowCopperPour = aEnable; }
  157. void SetDoNotAllowVias( bool aEnable ) { m_keepoutDoNotAllowVias = aEnable; }
  158. void SetDoNotAllowTracks( bool aEnable ) { m_keepoutDoNotAllowTracks = aEnable; }
  159. void SetDoNotAllowPads( bool aEnable ) { m_keepoutDoNotAllowPads = aEnable; }
  160. void SetDoNotAllowFootprints( bool aEnable ) { m_keepoutDoNotAllowFootprints = aEnable; }
  161. const ISLAND_REMOVAL_MODE GetIslandRemovalMode() const { return m_removeIslands; }
  162. void SetIslandRemovalMode( ISLAND_REMOVAL_MODE aRemove ) { m_removeIslands = aRemove; }
  163. long long int GetMinIslandArea() const { return m_minIslandArea; }
  164. void SetMinIslandArea( long long int aArea ) { m_minIslandArea = aArea; }
  165. };
  166. #endif // ZONE_SETTINGS_H_