24#ifndef DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA_H_
25#define DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA_H_
42 const wxString& aRuleName ) :
83 result.AddError(
_(
"Optimum Length must be greater than 0" ) );
86 result.AddError(
_(
"Tolerance must be greater than or equal to 0" ) );
91 result.AddError(
_(
"Tolerance is too large: resulting minimum length is not positive" ) );
99 auto formatDistance = [](
double aValue )
107 code = wxS(
"length" );
109 wxString clause = wxString::Format( wxS(
"(constraint %s (min %s) (opt %s) (max %s))" ), code,
166 std::vector<wxString> clauses;
177 skewClause = wxString::Format( wxS(
"(constraint skew (max %smm) (within_diff_pairs))" ),
185 clauses.push_back( skewClause );
209 if( !hasLength && !hasSkew )
210 result.AddError(
_(
"At least one constraint must be defined" ) );
216 result.AddError(
_(
"Maximum Skew must be greater than or equal to 0" ) );
BITMAPS
A list of all bitmap identifiers.
@ constraint_matched_length_diff_pair_v2
@ constraint_absolute_length_2
VALIDATION_RESULT Validate() const override
Validates the constraint data.
DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA()=default
double GetMaximumLength() const
BITMAPS GetOverlayBitmap() const override
Returns the bitmap to use for the overlay panel background.
double GetOptimumLength() const
double GetTolerance() const
DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA(int aId, int aParentId, double aOptLength, double aTolerance, const wxString &aRuleName)
void SetOptimumLength(double aLength)
void SetTolerance(double aTolerance)
wxString GenerateRule(const RULE_GENERATION_CONTEXT &aContext) override
std::vector< wxString > GetConstraintClauses(const RULE_GENERATION_CONTEXT &aContext) const override
Returns just the constraint clauses without the rule wrapper.
void CopyFrom(const ICopyable &aSource) override
std::vector< DRC_RE_FIELD_POSITION > GetFieldPositions() const override
Returns the field positions for controls overlaid on the constraint bitmap.
double GetMinimumLength() const
DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA(const DRC_RE_BASE_CONSTRAINT_DATA &aBaseData)
virtual ~DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA()=default
wxString GetConstraintCode() const
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_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA()=default
std::vector< DRC_RE_FIELD_POSITION > GetFieldPositions() const override
Returns the field positions for controls overlaid on the constraint bitmap.
double GetMaxSkew() const
BITMAPS GetOverlayBitmap() const override
Returns the bitmap to use for the overlay panel background.
void CopyFrom(const ICopyable &aSource) override
bool GetWithinDiffPairs() const
void SetWithinDiffPairs(bool aWithinDiffPairs)
VALIDATION_RESULT Validate() const override
Validates the constraint data.
std::vector< wxString > GetConstraintClauses(const RULE_GENERATION_CONTEXT &aContext) const override
Returns just the constraint clauses without the rule wrapper.
void SetMaxSkew(double aSkew)
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.
Result of a validation operation.
wxString result
Test unit parsing edge cases and error handling.