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.

94 lines
3.7 KiB

  1. /******************************************************/
  2. /* class ZONE_SETTING used to handle zones parameters */
  3. /******************************************************/
  4. #ifndef WX_PRECOMP
  5. #include "wx/wx.h"
  6. #endif
  7. /* For compilers that support precompilation:
  8. */
  9. #include "wx/wxprec.h"
  10. #ifdef __BORLANDC__
  11. #pragma hdrstop
  12. #endif
  13. #include "fctsys.h"
  14. #include "PolyLine.h"
  15. #include "common.h"
  16. #include "pcbnew.h"
  17. #include "zones.h"
  18. #include "class_zone.h"
  19. ZONE_SETTING::ZONE_SETTING( void )
  20. {
  21. m_FillMode = 0; // Mode for filling zone : 1 use segments, 0 use polygons
  22. m_ZoneClearance = 200; // Clearance value
  23. m_ZoneMinThickness = 100; // Min thickness value in filled areas
  24. m_NetcodeSelection = 0; // Net code selection for the current zone
  25. m_CurrentZone_Layer = 0; // Layer used to create the current zone
  26. m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches
  27. m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; /* Option to select number of segments to approximate a circle
  28. * ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
  29. * or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF segments */
  30. m_ThermalReliefGapValue = 200; // tickness of the gap in thermal reliefs
  31. m_ThermalReliefCopperBridgeValue = 200; // tickness of the copper bridge in thermal reliefs
  32. m_Zone_Pad_Options = THERMAL_PAD; // How pads are covered by copper in zone
  33. cornerSmoothingType = SMOOTHING_NONE;
  34. cornerRadius = 0;
  35. }
  36. /**
  37. * Function ImportSetting
  38. * copy settings from a given zone
  39. * @param aSource: the given zone
  40. */
  41. void ZONE_SETTING::ImportSetting( const ZONE_CONTAINER& aSource )
  42. {
  43. m_FillMode = aSource.m_FillMode;
  44. m_ZoneClearance = aSource.m_ZoneClearance;
  45. m_ZoneMinThickness = aSource.m_ZoneMinThickness;
  46. m_NetcodeSelection = aSource.GetNet();
  47. m_CurrentZone_Layer = aSource.GetLayer();
  48. m_Zone_HatchingStyle = aSource.GetHatchStyle();
  49. m_ArcToSegmentsCount = aSource.m_ArcToSegmentsCount;
  50. m_ThermalReliefGapValue = aSource.m_ThermalReliefGapValue;
  51. m_ThermalReliefCopperBridgeValue = aSource.m_ThermalReliefCopperBridgeValue;
  52. m_Zone_Pad_Options = aSource.m_PadOption;
  53. cornerSmoothingType = aSource.GetCornerSmoothingType();
  54. cornerRadius = aSource.GetCornerRadius();
  55. }
  56. /**
  57. * Function ExportSetting
  58. * copy settings to a given zone
  59. * @param aTarget: the given zone
  60. * @param aFullExport: if false: some parameters are NOT exported
  61. * because they must not be exported when export settings from a zone to others zones
  62. * Currently:
  63. * m_NetcodeSelection
  64. */
  65. void ZONE_SETTING::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport )
  66. {
  67. aTarget.m_FillMode = m_FillMode;
  68. aTarget.m_ZoneClearance = m_ZoneClearance;
  69. aTarget.m_ZoneMinThickness = m_ZoneMinThickness;
  70. aTarget.m_Poly->SetHatch( m_Zone_HatchingStyle );
  71. aTarget.m_ArcToSegmentsCount = m_ArcToSegmentsCount;
  72. aTarget.m_ThermalReliefGapValue = m_ThermalReliefGapValue;
  73. aTarget.m_ThermalReliefCopperBridgeValue = m_ThermalReliefCopperBridgeValue;
  74. aTarget.m_PadOption = m_Zone_Pad_Options;
  75. aTarget.SetCornerSmoothingType( cornerSmoothingType );
  76. aTarget.SetCornerRadius( cornerRadius );
  77. if( aFullExport )
  78. {
  79. aTarget.SetNet( m_NetcodeSelection );
  80. aTarget.SetLayer( m_CurrentZone_Layer );
  81. }
  82. }