private bool CheckAddCondition(ResolvedBodyCondition condition) { if (condition is ResolvedBodyCondition) { if (condition is RectangleCondition) { if (rectangleCondition != null) { return(false); } rectangleCondition = (RectangleCondition)condition; return(true); } if (condition is TriangleCondition) { if (triangleCondition != null) { return(false); } triangleCondition = (TriangleCondition)condition; return(true); } } return(false); }
public override bool RemoveCondition(Condition condition) { if (!(condition is ResolvedBodyCondition)) { return(false); } if (condition is RectangleCondition) { if (rectangleCondition != (RectangleCondition)condition) { return(false); } rectangleCondition = null; return(true); } if (condition is TriangleCondition) { if (triangleCondition != (TriangleCondition)condition) { return(false); } triangleCondition = null; return(true); } return(false); }
public RectangleConditionState(Tool tool, Condition condition, Geometry geometry) : base(tool, condition) { if (condition is RectangleCondition) { this.condition = (RectangleCondition)condition; } if (geometry is ResolvedBody) { this.geometry = (ResolvedBody)geometry; } }
public override Condition GenerateCondition(Geometry geometry, FormInput formInput) { bool valid = ValidateInput(geometry, formInput); if (!valid) { return(null); } // FormNum height = (FormNum)formInput.inputs[2]; // FormNum width = (FormNum)formInput.inputs[6]; RectangleCondition condition = new RectangleCondition(2, 1); return(condition); }
public override void ClearConditions() { rectangleCondition = null; triangleCondition = null; }