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.

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