コード例 #1
0
ファイル: StepPattern.cs プロジェクト: johankson/Patternizer
        public StepPattern Bounds(BoundsDescriptor bounds)
        {
            if (_steps.Count == 0)
            {
                throw new Exception("The has to be at least one step in the pattern");
            }

            var lastStep = _steps.Last();

            lastStep.BoundsConstraint = bounds;

            return(this);
        }
コード例 #2
0
ファイル: Step.cs プロジェクト: johankson/Patternizer
        private bool EvaluateBounds(BoundsDescriptor flags, StepContext context)
        {
            // Concept code, this should be checked for invalid combinations
            if (flags.HasFlag(BoundsDescriptor.IsWide) && context.Width < context.Height * Settings.WideCutoffValue)
            {
                Debug.WriteLine($"Evaluation failed: Bounds was set to IsWide but the shape isn't wide. Width={context.Width}, Height={context.Height}, WideCutoffValue value={Settings.WideCutoffValue}");
                return(false);
            }

            if (flags.HasFlag(BoundsDescriptor.IsTall) && context.Height < context.Width * Settings.TallCutoffValue)
            {
                // TODO Add debug output
                return(false);
            }

            return(true);
        }