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.

166 lines
5.4 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
11 years ago
5 years ago
11 years ago
5 years ago
5 years ago
5 years ago
  1. /*
  2. * KiRouter - a push-and-(sometimes-)shove PCB router
  3. *
  4. * Copyright (C) 2014 CERN
  5. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  6. * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
  7. *
  8. * This program is free software: you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation, either version 3 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef __PNS_SIZES_SETTINGS_H
  22. #define __PNS_SIZES_SETTINGS_H
  23. #include <map>
  24. #include <optional>
  25. #include "pcb_track.h" // for VIATYPE_T
  26. class BOARD;
  27. class BOARD_DESIGN_SETTINGS;
  28. namespace PNS {
  29. class ITEM;
  30. class SIZES_SETTINGS
  31. {
  32. public:
  33. SIZES_SETTINGS() :
  34. m_clearance( 0 ),
  35. m_minClearance( 0 ),
  36. m_trackWidth( 155000 ),
  37. m_trackWidthIsExplicit( true ),
  38. m_boardMinTrackWidth( 0 ),
  39. m_viaType( VIATYPE::THROUGH ),
  40. m_viaDiameter( 600000 ),
  41. m_viaDrill( 250000 ),
  42. m_diffPairWidth( 125000 ),
  43. m_diffPairGap( 180000 ),
  44. m_diffPairViaGap( 180000 ),
  45. m_diffPairViaGapSameAsTraceGap( true ),
  46. m_holeToHole( 0 ),
  47. m_diffPairHoleToHole( 0 )
  48. {};
  49. ~SIZES_SETTINGS() {};
  50. void ClearLayerPairs();
  51. void AddLayerPair( int aL1, int aL2 );
  52. // The working clearance, from the current net to anything else (without knowing the net of the
  53. // other object). Specific clearance to another object may be resolved differently.
  54. int Clearance() const { return m_clearance; }
  55. void SetClearance( int aClearance ) { m_clearance = aClearance; }
  56. // The absolute minimum clearance from the board
  57. int MinClearance() const { return m_minClearance; }
  58. void SetMinClearance( int aClearance ) { m_minClearance = aClearance; }
  59. int TrackWidth() const { return m_trackWidth; }
  60. void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
  61. bool TrackWidthIsExplicit() const { return m_trackWidthIsExplicit; }
  62. void SetTrackWidthIsExplicit( bool aIsExplicit ) { m_trackWidthIsExplicit = aIsExplicit; }
  63. int BoardMinTrackWidth() const { return m_boardMinTrackWidth; }
  64. void SetBoardMinTrackWidth( int aWidth ) { m_boardMinTrackWidth = aWidth; }
  65. int DiffPairWidth() const { return m_diffPairWidth; }
  66. int DiffPairGap() const { return m_diffPairGap; }
  67. int DiffPairViaGap() const
  68. {
  69. return m_diffPairViaGapSameAsTraceGap ? m_diffPairGap : m_diffPairViaGap;
  70. }
  71. bool DiffPairViaGapSameAsTraceGap() const { return m_diffPairViaGapSameAsTraceGap; }
  72. void SetDiffPairWidth( int aWidth ) { m_diffPairWidth = aWidth; }
  73. void SetDiffPairGap( int aGap ) { m_diffPairGap = aGap; }
  74. void SetDiffPairViaGapSameAsTraceGap ( bool aEnable )
  75. {
  76. m_diffPairViaGapSameAsTraceGap = aEnable;
  77. }
  78. void SetDiffPairViaGap( int aGap ) { m_diffPairViaGap = aGap; }
  79. int ViaDiameter() const { return m_viaDiameter; }
  80. void SetViaDiameter( int aDiameter ) { m_viaDiameter = aDiameter; }
  81. int ViaDrill() const { return m_viaDrill; }
  82. void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
  83. std::optional<int> PairedLayer( int aLayerId )
  84. {
  85. if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
  86. return std::optional<int>();
  87. return m_layerPairs[aLayerId];
  88. }
  89. int GetLayerTop() const;
  90. int GetLayerBottom() const;
  91. void SetHoleToHole( int aHoleToHole ) { m_holeToHole = aHoleToHole; }
  92. int GetHoleToHole() const { return m_holeToHole; }
  93. void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
  94. VIATYPE ViaType() const { return m_viaType; }
  95. wxString GetClearanceSource() const { return m_clearanceSource; }
  96. void SetClearanceSource( const wxString& aSource ) { m_clearanceSource = aSource; }
  97. wxString GetWidthSource() const { return m_widthSource; }
  98. void SetWidthSource( const wxString& aSource ) { m_widthSource = aSource; }
  99. wxString GetDiffPairWidthSource() const { return m_diffPairWidthSource; }
  100. void SetDiffPairWidthSource( const wxString& aSource ) { m_diffPairWidthSource = aSource; }
  101. wxString GetDiffPairGapSource() const { return m_diffPairGapSource; }
  102. void SetDiffPairGapSource( const wxString& aSource ) { m_diffPairGapSource = aSource; }
  103. void SetDiffPairHoleToHole( int aHoleToHole ) { m_diffPairHoleToHole = aHoleToHole; }
  104. int GetDiffPairHoleToHole() const { return m_diffPairHoleToHole; }
  105. private:
  106. int m_clearance;
  107. int m_minClearance;
  108. int m_trackWidth;
  109. bool m_trackWidthIsExplicit;
  110. int m_boardMinTrackWidth;
  111. VIATYPE m_viaType;
  112. int m_viaDiameter;
  113. int m_viaDrill;
  114. int m_diffPairWidth;
  115. int m_diffPairGap;
  116. int m_diffPairViaGap;
  117. bool m_diffPairViaGapSameAsTraceGap;
  118. int m_holeToHole;
  119. int m_diffPairHoleToHole;
  120. std::map<int, int> m_layerPairs;
  121. wxString m_clearanceSource;
  122. wxString m_widthSource;
  123. wxString m_diffPairWidthSource;
  124. wxString m_diffPairGapSource;
  125. };
  126. }
  127. #endif // __PNS_SIZES_SETTINGS_H