24#ifndef DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA_H_
25#define DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA_H_
42 bool aAllowNinetyDegrees,
bool aAllowOneEightyDegrees,
43 bool aAllowTwoSeventyDegrees,
bool aAllowAllDegrees,
44 const wxString& aRuleName ) :
77 terms.Add( wxS(
"A.Orientation == 0 deg" ) );
80 terms.Add( wxS(
"A.Orientation == 90 deg" ) );
83 terms.Add( wxS(
"A.Orientation == 180 deg" ) );
86 terms.Add( wxS(
"A.Orientation == 270 deg" ) );
91 wxString expr = wxJoin( terms,
'|' );
92 expr.Replace( wxS(
"|" ), wxS(
" || " ) );
94 wxString clause = wxString::Format( wxS(
"(constraint assertion \"%s\")" ), expr );
111 result.AddError(
_(
"At least one orientation must be selected" ) );
148 if( aAllowAllDegrees )
BITMAPS
A list of all bitmap identifiers.
@ constraint_allowed_orientation
bool GetIsZeroDegreesAllowed()
DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA()=default
bool m_allowOneEightyDegrees
std::vector< wxString > GetConstraintClauses(const RULE_GENERATION_CONTEXT &aContext) const override
Returns just the constraint clauses without the rule wrapper.
DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA(int aId, int aParentId, bool aAllowZeroDegrees, bool aAllowNinetyDegrees, bool aAllowOneEightyDegrees, bool aAllowTwoSeventyDegrees, bool aAllowAllDegrees, const wxString &aRuleName)
void CopyFrom(const ICopyable &aSource) override
wxString GenerateRule(const RULE_GENERATION_CONTEXT &aContext) override
bool m_allowTwoSeventyDegrees
DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA(const DRC_RE_BASE_CONSTRAINT_DATA &aBaseData)
bool GetIsOneEightyDegreesAllowed()
bool GetIsNinetyDegreesAllowed()
std::vector< DRC_RE_FIELD_POSITION > GetFieldPositions() const override
Returns the field positions for controls overlaid on the constraint bitmap.
virtual ~DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA()=default
void SetIsTwoSeventyDegreesAllowed(bool aAllowTwoSeventyDegrees)
bool m_allowNinetyDegrees
VALIDATION_RESULT Validate() const override
Validates the constraint data.
BITMAPS GetOverlayBitmap() const override
Returns the bitmap to use for the overlay panel background.
bool GetIsAllDegreesAllowed()
void SetIsNinetyDegreesAllowed(bool aAllowNinetyDegrees)
void SetIsOneEightyDegreesAllowed(bool aAllowOneEightyDegrees)
void SetIsAllDegreesAllowed(bool aAllowAllDegrees)
void SetIsZeroDegreesAllowed(bool aAllowZeroDegrees)
bool GetIsTwoSeventyDegreesAllowed()
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
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.