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.

124 lines
5.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
  1. /**
  2. * @brief class ZONE_SETTINGS used to handle zones parameters
  3. */
  4. /*
  5. * This program source code file is part of KiCad, a free EDA CAD application.
  6. *
  7. * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
  8. * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  9. * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version 2
  14. * of the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, you may find one here:
  23. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  24. * or you may search the http://www.gnu.org website for the version 2 license,
  25. * or you may write to the Free Software Foundation, Inc.,
  26. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  27. */
  28. #include <fctsys.h>
  29. #include <common.h>
  30. #include <pcbnew.h>
  31. #include <zones.h>
  32. #include <class_zone.h>
  33. ZONE_SETTINGS::ZONE_SETTINGS()
  34. {
  35. m_ZonePriority = 0;
  36. m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons
  37. // Clearance value
  38. m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL );
  39. // Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) :
  40. m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL );
  41. m_NetcodeSelection = 0; // Net code selection for the current zone
  42. m_CurrentZone_Layer = FIRST_LAYER; // Layer used to create the current zone
  43. m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches
  44. m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle
  45. // ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
  46. // or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments
  47. // thickness of the gap in thermal reliefs:
  48. m_ThermalReliefGap = Mils2iu( ZONE_THERMAL_RELIEF_GAP_MIL );
  49. // thickness of the copper bridge in thermal reliefs:
  50. m_ThermalReliefCopperBridge = Mils2iu( ZONE_THERMAL_RELIEF_COPPER_WIDTH_MIL );
  51. m_PadConnection = THERMAL_PAD; // How pads are covered by copper in zone
  52. m_Zone_45_Only = false;
  53. m_cornerSmoothingType = SMOOTHING_NONE;
  54. m_cornerRadius = 0;
  55. SetIsKeepout( false );
  56. SetDoNotAllowCopperPour( false );
  57. SetDoNotAllowVias( true );
  58. SetDoNotAllowTracks( true );
  59. }
  60. ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
  61. {
  62. m_ZonePriority = aSource.GetPriority();
  63. m_FillMode = aSource.GetFillMode();
  64. m_ZoneClearance = aSource.GetClearance();
  65. m_ZoneMinThickness = aSource.GetMinThickness();
  66. m_NetcodeSelection = aSource.GetNet();
  67. m_CurrentZone_Layer = aSource.GetLayer();
  68. m_Zone_HatchingStyle = aSource.GetHatchStyle();
  69. m_ArcToSegmentsCount = aSource.GetArcSegmentCount();
  70. m_ThermalReliefGap = aSource.GetThermalReliefGap();
  71. m_ThermalReliefCopperBridge = aSource.GetThermalReliefCopperBridge();
  72. m_PadConnection = aSource.GetPadConnection();
  73. m_cornerSmoothingType = aSource.GetCornerSmoothingType();
  74. m_cornerRadius = aSource.GetCornerRadius();
  75. m_isKeepout = aSource.GetIsKeepout();
  76. m_keepoutDoNotAllowCopperPour = aSource.GetDoNotAllowCopperPour();
  77. m_keepoutDoNotAllowVias = aSource.GetDoNotAllowVias();
  78. m_keepoutDoNotAllowTracks = aSource.GetDoNotAllowTracks();
  79. return *this;
  80. }
  81. void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) const
  82. {
  83. aTarget.SetFillMode( m_FillMode );
  84. aTarget.SetZoneClearance( m_ZoneClearance );
  85. aTarget.SetMinThickness( m_ZoneMinThickness );
  86. aTarget.SetArcSegmentCount( m_ArcToSegmentsCount );
  87. aTarget.SetThermalReliefGap( m_ThermalReliefGap );
  88. aTarget.SetThermalReliefCopperBridge( m_ThermalReliefCopperBridge );
  89. aTarget.SetPadConnection( m_PadConnection );
  90. aTarget.SetCornerSmoothingType( m_cornerSmoothingType );
  91. aTarget.SetCornerRadius( m_cornerRadius );
  92. aTarget.SetIsKeepout( GetIsKeepout() );
  93. aTarget.SetDoNotAllowCopperPour( GetDoNotAllowCopperPour() );
  94. aTarget.SetDoNotAllowVias( GetDoNotAllowVias() );
  95. aTarget.SetDoNotAllowTracks( GetDoNotAllowTracks() );
  96. if( aFullExport )
  97. {
  98. aTarget.SetPriority( m_ZonePriority );
  99. aTarget.SetNet( m_NetcodeSelection );
  100. aTarget.SetLayer( m_CurrentZone_Layer );
  101. aTarget.Outline()->SetLayer( m_CurrentZone_Layer );
  102. }
  103. // call SetHatch last, because hatch lines will be rebuilt,
  104. // using new parameters values
  105. aTarget.Outline()->SetHatch( m_Zone_HatchingStyle, Mils2iu( 20 ), true );
  106. }