|
KiCad PCB EDA Suite
|
Loads DRC rules from .kicad_dru files and converts them to panel entries. More...
#include <drc_re_rule_loader.h>
Public Member Functions | |
| DRC_RULE_LOADER () | |
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > | LoadRule (const DRC_RULE &aRule, const wxString &aOriginalText) |
| Load a single DRC_RULE and convert it to panel entries. | |
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > | LoadFile (const wxString &aPath) |
| Load all rules from a .kicad_dru file. | |
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > | LoadFromString (const wxString &aRulesText) |
| Load rules from a text string. | |
Private Member Functions | |
| std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > | createConstraintData (DRC_RULE_EDITOR_CONSTRAINT_NAME aPanel, const DRC_RULE &aRule, const std::set< DRC_CONSTRAINT_T > &aClaimedConstraints) |
| Create the appropriate constraint data object for a panel type. | |
| const DRC_CONSTRAINT * | findConstraint (const DRC_RULE &aRule, DRC_CONSTRAINT_T aType) |
| Find a constraint of a specific type in a rule. | |
| double | toMM (int aValue) |
| Convert internal units (nanometers) to millimeters. | |
Private Attributes | |
| DRC_PANEL_MATCHER | m_matcher |
Loads DRC rules from .kicad_dru files and converts them to panel entries.
This class handles the conversion of text-based DRC rules into the appropriate graphical panel representations. Rules with multiple constraints may be split across multiple panel entries, with the condition and severity duplicated to each.
Definition at line 47 of file drc_re_rule_loader.h.
| DRC_RULE_LOADER::DRC_RULE_LOADER | ( | ) |
Definition at line 42 of file drc_re_rule_loader.cpp.
|
private |
Create the appropriate constraint data object for a panel type.
| aPanel | The target panel type. |
| aRule | The source rule. |
| aClaimedConstraints | The constraints this panel should handle. |
Definition at line 66 of file drc_re_rule_loader.cpp.
References ABSOLUTE_LENGTH, CUSTOM_RULE, DIFF_PAIR_GAP_CONSTRAINT, findConstraint(), DRC_RULE_EDITOR_UTILS::GetConstraintCode(), DRC_CONSTRAINT::GetValue(), HOLE_SIZE_CONSTRAINT, DRC_RULE_EDITOR_UTILS::IsNumericInputType(), LENGTH_CONSTRAINT, DRC_RULE::m_Name, MINOPTMAX< T >::Max(), MAX_UNCOUPLED_CONSTRAINT, MINOPTMAX< T >::Min(), MINIMUM_TEXT_HEIGHT_AND_THICKNESS, MINOPTMAX< T >::Opt(), ROUTING_DIFF_PAIR, ROUTING_WIDTH, TEXT_HEIGHT_CONSTRAINT, TEXT_THICKNESS_CONSTRAINT, toMM(), TRACK_WIDTH_CONSTRAINT, VIA_COUNT_CONSTRAINT, VIA_DIAMETER_CONSTRAINT, and VIA_STYLE.
Referenced by LoadRule().
|
private |
Find a constraint of a specific type in a rule.
| aRule | The rule to search. |
| aType | The constraint type to find. |
Definition at line 53 of file drc_re_rule_loader.cpp.
References DRC_RULE::m_Constraints, and DRC_CONSTRAINT::m_Type.
Referenced by createConstraintData().
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > DRC_RULE_LOADER::LoadFile | ( | const wxString & | aPath | ) |
Load all rules from a .kicad_dru file.
| aPath | Path to the rules file. |
Definition at line 317 of file drc_re_rule_loader.cpp.
References LoadFromString().
Referenced by DIALOG_DRC_RULE_EDITOR::LoadExistingRules().
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > DRC_RULE_LOADER::LoadFromString | ( | const wxString & | aRulesText | ) |
Load rules from a text string.
| aRulesText | The text content of the rules. |
Definition at line 282 of file drc_re_rule_loader.cpp.
References LoadRule(), and DRC_RULES_PARSER::Parse().
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(), 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(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and LoadFile().
| std::vector< DRC_RE_LOADED_PANEL_ENTRY > DRC_RULE_LOADER::LoadRule | ( | const DRC_RULE & | aRule, |
| const wxString & | aOriginalText ) |
Load a single DRC_RULE and convert it to panel entries.
If the rule contains more constraints than a single panel can handle, it will be split into multiple entries, preserving order.
| aRule | The parsed DRC rule to convert. |
| aOriginalText | The original text of the rule for round-trip fidelity. |
Definition at line 231 of file drc_re_rule_loader.cpp.
References createConstraintData(), CUSTOM_RULE, DRC_RULE_CONDITION::GetExpression(), DRC_RULE::m_Condition, DRC_RULE::m_LayerCondition, m_matcher, DRC_RULE::m_Name, DRC_RULE::m_Severity, and DRC_RE_LOADED_PANEL_ENTRY::originalRuleText.
Referenced by LoadFromString().
|
private |
Convert internal units (nanometers) to millimeters.
Definition at line 47 of file drc_re_rule_loader.cpp.
Referenced by createConstraintData().
|
private |
Definition at line 109 of file drc_re_rule_loader.h.
Referenced by LoadRule().