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