|
KiCad PCB EDA Suite
|
Maps DRC rule constraints to appropriate editor panels. More...
#include <drc_re_panel_matcher.h>
Public Member Functions | |
| DRC_PANEL_MATCHER () | |
| Panel Claim Priority System. | |
| std::vector< DRC_PANEL_MATCH > | MatchRule (const DRC_RULE &aRule) |
| Match a DRC rule to one or more panel types. | |
| bool | CanPanelLoad (DRC_RULE_EDITOR_CONSTRAINT_NAME aPanel, const std::set< DRC_CONSTRAINT_T > &aConstraints) |
| Check if a specific panel type can load a set of constraints. | |
| DRC_RULE_EDITOR_CONSTRAINT_NAME | GetPanelForConstraint (DRC_CONSTRAINT_T aConstraintType) |
| Get the panel type for a single constraint. | |
Private Member Functions | |
| void | initClaims () |
| bool | matchesClaim (const DRC_PANEL_CLAIM &aClaim, const std::set< DRC_CONSTRAINT_T > &aConstraints, std::set< DRC_CONSTRAINT_T > *aClaimedOut) |
Private Attributes | |
| std::vector< DRC_PANEL_CLAIM > | m_claims |
Maps DRC rule constraints to appropriate editor panels.
When loading a .kicad_dru file, this class determines which graphical panels should be used to edit each rule. Multi-constraint panels (like VIA_STYLE which handles both via_diameter and hole_size) have higher priority and are tried first.
If a rule contains more constraints than any single panel can handle, it will be split across multiple panels. Constraints that cannot be mapped to any panel are sent to the CUSTOM_RULE fallback panel.
Definition at line 89 of file drc_re_panel_matcher.h.
| DRC_PANEL_MATCHER::DRC_PANEL_MATCHER | ( | ) |
Panel Claim Priority System.
When a DRC rule contains multiple constraints, the matcher must decide which graphical panels should edit each constraint. The priority system ensures deterministic, user-friendly matching.
Priority tiers: 100 Multi-constraint panels that combine related constraints (e.g., ROUTING_DIFF_PAIR handles track_width + diff_pair_gap together) 80-90 Two-constraint panels (VIA_STYLE, TEXT_HEIGHT_THICKNESS) 60-70 Single-constraint panels with min/opt/max semantics 20-30 Generic single-constraint panels 5-15 Boolean and fallback panels 0 CUSTOM_RULE catches all unmapped constraints
Algorithm:
Example: A rule with track_width + diff_pair_gap + clearance becomes
Definition at line 58 of file drc_re_panel_matcher.cpp.
References initClaims().
| bool DRC_PANEL_MATCHER::CanPanelLoad | ( | DRC_RULE_EDITOR_CONSTRAINT_NAME | aPanel, |
| const std::set< DRC_CONSTRAINT_T > & | aConstraints ) |
Check if a specific panel type can load a set of constraints.
| aPanel | The panel type to check. |
| aConstraints | The constraint types to check. |
Definition at line 320 of file drc_re_panel_matcher.cpp.
References CUSTOM_RULE, and m_claims.
Referenced by BOOST_AUTO_TEST_CASE().
| DRC_RULE_EDITOR_CONSTRAINT_NAME DRC_PANEL_MATCHER::GetPanelForConstraint | ( | DRC_CONSTRAINT_T | aConstraintType | ) |
Get the panel type for a single constraint.
This is a convenience method for simple rules with one constraint.
| aConstraintType | The DRC constraint type. |
Definition at line 346 of file drc_re_panel_matcher.cpp.
References CUSTOM_RULE, and m_claims.
Referenced by BOOST_AUTO_TEST_CASE().
|
private |
Definition at line 64 of file drc_re_panel_matcher.cpp.
References ABSOLUTE_LENGTH, ALLOWED_ORIENTATION, ANNULAR_WIDTH_CONSTRAINT, ASSERTION_CONSTRAINT, CLEARANCE_CONSTRAINT, CONNECTION_WIDTH_CONSTRAINT, COPPER_TO_EDGE_CLEARANCE, COPPER_TO_HOLE_CLEARANCE, COURTYARD_CLEARANCE, COURTYARD_CLEARANCE_CONSTRAINT, CREEPAGE_CONSTRAINT, CREEPAGE_DISTANCE, DIFF_PAIR_GAP_CONSTRAINT, DISALLOW_CONSTRAINT, EDGE_CLEARANCE_CONSTRAINT, HOLE_CLEARANCE_CONSTRAINT, HOLE_SIZE, HOLE_SIZE_CONSTRAINT, HOLE_TO_HOLE_CLEARANCE, HOLE_TO_HOLE_CONSTRAINT, LENGTH_CONSTRAINT, m_claims, MATCHED_LENGTH_DIFF_PAIR, MAX_UNCOUPLED_CONSTRAINT, MAXIMUM_VIA_COUNT, MIN_RESOLVED_SPOKES_CONSTRAINT, MINIMUM_ANNULAR_WIDTH, MINIMUM_CLEARANCE, MINIMUM_CONNECTION_WIDTH, MINIMUM_TEXT_HEIGHT_AND_THICKNESS, MINIMUM_THERMAL_RELIEF_SPOKE_COUNT, MINIMUM_VIA_DIAMETER, PERMITTED_LAYERS, PHYSICAL_CLEARANCE, PHYSICAL_CLEARANCE_CONSTRAINT, ROUTING_DIFF_PAIR, ROUTING_WIDTH, SILK_CLEARANCE_CONSTRAINT, SILK_TO_SILK_CLEARANCE, SKEW_CONSTRAINT, SOLDER_MASK_EXPANSION_CONSTRAINT, SOLDER_PASTE_ABS_MARGIN_CONSTRAINT, SOLDERMASK_EXPANSION, SOLDERPASTE_EXPANSION, TEXT_HEIGHT_CONSTRAINT, TEXT_THICKNESS_CONSTRAINT, TRACK_WIDTH_CONSTRAINT, VIA_COUNT_CONSTRAINT, VIA_DIAMETER_CONSTRAINT, VIA_STYLE, and VIAS_UNDER_SMD.
Referenced by DRC_PANEL_MATCHER().
|
private |
Definition at line 251 of file drc_re_panel_matcher.cpp.
References DRC_PANEL_CLAIM::optionalConstraints, and DRC_PANEL_CLAIM::requiredConstraints.
Referenced by MatchRule().
| std::vector< DRC_PANEL_MATCH > DRC_PANEL_MATCHER::MatchRule | ( | const DRC_RULE & | aRule | ) |
Match a DRC rule to one or more panel types.
The rule's constraints are analyzed and matched to panels using a priority-based system. Multi-constraint panels are tried first. If a rule has more constraints than one panel can handle, multiple panel matches are returned.
| aRule | The DRC rule to analyze. |
Definition at line 278 of file drc_re_panel_matcher.cpp.
References CUSTOM_RULE, m_claims, DRC_RULE::m_Constraints, DRC_CONSTRAINT::m_Type, matchesClaim(), and NULL_CONSTRAINT.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
private |
Definition at line 134 of file drc_re_panel_matcher.h.
Referenced by CanPanelLoad(), GetPanelForConstraint(), initClaims(), and MatchRule().