24#ifndef DRC_RE_VIA_STYLE_CONSTRAINT_DATA_H_
25#define DRC_RE_VIA_STYLE_CONSTRAINT_DATA_H_
51 double aMinViaDiameter,
double aMaxViaDiameter,
52 double aMinViaHoleSize,
double aMaxViaHoleSize,
91 result.AddError(
_(
"Minimum Via Diameter must be greater than 0" ) );
94 result.AddError(
_(
"Maximum Via Diameter must be greater than 0" ) );
97 result.AddError(
_(
"Minimum Via Diameter cannot be greater than Maximum Via Diameter" ) );
103 result.AddError(
_(
"Minimum Via Hole Size must be greater than 0" ) );
106 result.AddError(
_(
"Maximum Via Hole Size must be greater than 0" ) );
109 result.AddError(
_(
"Minimum Via Hole Size cannot be greater than Maximum Via Hole Size" ) );
112 if( !hasDiameter && !hasHoleSize )
113 result.AddError(
_(
"At least one constraint must be specified" ) );
120 auto formatDimension = [](
double aValue )
125 std::vector<wxString> clauses;
129 clauses.push_back( wxString::Format( wxS(
"(constraint via_diameter (min %s) (max %s))" ),
136 clauses.push_back( wxString::Format( wxS(
"(constraint hole_size (min %s) (max %s))" ),
150 if( !viaTypeCondition.IsEmpty() )
190 default:
return wxEmptyString;
BITMAPS
A list of all bitmap identifiers.
static wxString formatDouble(double aValue, int aPrecision=6)
wxString buildRule(const RULE_GENERATION_CONTEXT &aContext, const std::vector< wxString > &aConstraintClauses) const
void CopyFrom(const ICopyable &aSource) override
DRC_RE_BASE_CONSTRAINT_DATA()=default
DRC_RE_VIA_STYLE_CONSTRAINT_DATA(int aId, int aParentId, const wxString &aRuleName, double aMinViaDiameter, double aMaxViaDiameter, double aMinViaHoleSize, double aMaxViaHoleSize, VIA_STYLE_TYPE aViaType=VIA_STYLE_TYPE::ANY)
double GetMaxViaDiameter()
void SetMinViaDiameter(double aMinViaDiameter)
wxString GetViaTypeCondition() const
BITMAPS GetOverlayBitmap() const override
Returns the bitmap to use for the overlay panel background.
DRC_RE_VIA_STYLE_CONSTRAINT_DATA()=default
double GetMinViaHoleSize()
double GetMinViaDiameter()
void SetMinViaHoleSize(double aMinViaHoleSize)
double GetMaxViaHoleSize()
void CopyFrom(const ICopyable &aSource) override
std::vector< wxString > GetConstraintClauses(const RULE_GENERATION_CONTEXT &aContext) const override
Returns just the constraint clauses without the rule wrapper.
VIA_STYLE_TYPE GetViaType() const
void SetMaxViaDiameter(double aMaxViaDiameter)
virtual ~DRC_RE_VIA_STYLE_CONSTRAINT_DATA()=default
DRC_RE_VIA_STYLE_CONSTRAINT_DATA(const DRC_RE_BASE_CONSTRAINT_DATA &aBaseData)
void SetMaxViaHoleSize(double aMaxViaHoleSize)
std::vector< DRC_RE_FIELD_POSITION > GetFieldPositions() const override
Returns the field positions for controls overlaid on the constraint bitmap.
void SetViaType(VIA_STYLE_TYPE aType)
VALIDATION_RESULT Validate() const override
Validates the constraint data.
wxString GenerateRule(const RULE_GENERATION_CONTEXT &aContext) override
Abstract interface class to enable polymorphic copying between objects.
constexpr int DRC_RE_OVERLAY_XO
constexpr int DRC_RE_OVERLAY_YO
@ RIGHT
Label to the right of the field.
@ LEFT
Label to the left of the field.
wxString conditionExpression
Result of a validation operation.
wxString result
Test unit parsing edge cases and error handling.