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.

111 lines
3.0 KiB

6 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #ifndef DRC_RULE_H
  24. #define DRC_RULE_H
  25. #include <core/typeinfo.h>
  26. #include <netclass.h>
  27. #include <layers_id_colors_and_visibility.h>
  28. class BOARD_ITEM;
  29. #define CLEARANCE_CONSTRAINT (1 << 0)
  30. #define ANNULUS_CONSTRAINT (1 << 1)
  31. #define TRACK_CONSTRAINT (1 << 2)
  32. #define HOLE_CONSTRAINT (1 << 3)
  33. #define DISALLOW_CONSTRAINT (1 << 4)
  34. #define DISALLOW_VIAS (1 << 0)
  35. #define DISALLOW_MICRO_VIAS (1 << 1)
  36. #define DISALLOW_BB_VIAS (1 << 2)
  37. #define DISALLOW_TRACKS (1 << 3)
  38. #define DISALLOW_PADS (1 << 4)
  39. #define DISALLOW_ZONES (1 << 5)
  40. #define DISALLOW_TEXTS (1 << 6)
  41. #define DISALLOW_GRAPHICS (1 << 7)
  42. #define DISALLOW_HOLES (1 << 8)
  43. #define DISALLOW_FOOTPRINTS (1 << 9)
  44. class DRC_RULE
  45. {
  46. public:
  47. DRC_RULE() :
  48. m_ConstraintFlags( 0 ),
  49. m_DisallowFlags( 0 ),
  50. m_Clearance( { 0, 0, INT_MAX / 2 } ),
  51. m_MinAnnulusWidth( 0 ),
  52. m_TrackConstraint( { 0, 0, INT_MAX / 2 } ),
  53. m_MinHole( 0 )
  54. { }
  55. struct MINOPTMAX
  56. {
  57. int Min;
  58. int Opt;
  59. int Max;
  60. };
  61. public:
  62. wxString m_Name;
  63. int m_ConstraintFlags;
  64. int m_DisallowFlags;
  65. // A 0 value means the property is not modified by this rule.
  66. // A positive value is a minimum.
  67. MINOPTMAX m_Clearance;
  68. int m_MinAnnulusWidth;
  69. MINOPTMAX m_TrackConstraint;
  70. int m_MinHole;
  71. wxString m_Condition;
  72. };
  73. class DRC_SELECTOR
  74. {
  75. public:
  76. DRC_SELECTOR() :
  77. m_Priority( 1 ),
  78. m_Rule( nullptr )
  79. { }
  80. public:
  81. std::vector<NETCLASSPTR> m_MatchNetclasses;
  82. std::vector<KICAD_T> m_MatchTypes;
  83. std::vector<PCB_LAYER_ID> m_MatchLayers;
  84. std::vector<wxString> m_MatchAreas;
  85. int m_Priority; // 0 indicates automatic priority generation
  86. DRC_RULE* m_Rule;
  87. };
  88. DRC_RULE* GetRule( const BOARD_ITEM* aItem, const BOARD_ITEM* bItem, int aConstraint );
  89. #endif // DRC_RULE_H