Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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;
        }
    }
Esempio n. 3
0
    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);
    }
Esempio n. 4
0
    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);
    }
Esempio n. 5
0
 public override void ClearConditions()
 {
     lengthCondition = null;
     widthCondition  = null;
     heightCondition = null;
 }