private bool CheckAddCondition(CuboidCondition condition) { if (condition is CuboidLengthCondition) { if (lengthCondition != null) { return(false); } lengthCondition = (CuboidLengthCondition)condition; return(true); } if (condition is CuboidWidthCondition) { if (widthCondition != null) { return(false); } widthCondition = (CuboidWidthCondition)condition; return(true); } if (condition is CuboidHeightCondition) { if (heightCondition != null) { return(false); } heightCondition = (CuboidHeightCondition)condition; return(true); } return(false); }
public CuboidLengthConditionState(Tool tool, Condition condition, Geometry geometry) : base(tool, condition) { if (condition is CuboidLengthCondition) { this.condition = (CuboidLengthCondition)condition; } if (geometry is Cuboid) { this.geometry = (Cuboid)geometry; } }
public override Condition GenerateCondition(Geometry geometry, FormInput formInput) { bool valid = ValidateInput(geometry, formInput); if (!valid) { return(null); } FormNum formNum = (FormNum)formInput.inputs[2]; CuboidLengthCondition condition = new CuboidLengthCondition(formNum.num); return(condition); }
public override bool RemoveCondition(Condition condition) { if (!(condition is CuboidCondition)) { return(false); } if (condition is CuboidLengthCondition) { if (lengthCondition != (CuboidLengthCondition)condition) { return(false); } lengthCondition = null; return(true); } if (condition is CuboidWidthCondition) { if (widthCondition != (CuboidWidthCondition)condition) { return(false); } widthCondition = null; return(true); } if (condition is CuboidHeightCondition) { if (heightCondition != (CuboidHeightCondition)condition) { return(false); } heightCondition = null; return(true); } return(false); }
public override void ClearConditions() { lengthCondition = null; widthCondition = null; heightCondition = null; }