Exemplo n.º 1
0
        private void _findSizes()
        {
            Blocks = new List<Block>();
            foreach (var op in _operator.PDown)
            {
                var go = new GraphicOperator(op);
                Height += go.Height + 2;
                Width = Math.Max(go.Width, Width);

                Blocks.Add(go);
            }
        }
Exemplo n.º 2
0
        private void _switchCondition()
        {
            /*
             Complex operators in switch will kill program
             */
            _block = new ConditionalSpecBlock() { Text = _operator.Text, X = 0, Y = 0};
            Blocks = new List<Block>();
            Block prev = _block;

            Width = _block.Width;
            Height = _block.Height;
            foreach (var o in _operator.PDown)
            {
                Block graph = new GraphicOperator(o) { X = X + _block.Width / 2, Y = prev.Y + prev.Height + 2};
                Graphics.DrawImage(graph.Image, graph.RX, graph.RY);

                Height += graph.Height + 2;
                prev = graph;
                Width = Math.Max(Width, graph.Width + _block.Width/2);
                Blocks.Add(graph);
            }

            Graphics.DrawArrow(ArrowPen, _block.RX + _block.RWidth / 2, _block.RY+_block.RHeight,
                                         _block.RX + _block.RWidth / 2, RHeight + 40);

            foreach (var o in _operator.PDefault)
            {
                Block graph = new GraphicOperator(o) { X = X, Y = prev.Y + prev.Height + 2 };
                Graphics.DrawImage(graph.Image, graph.RX, graph.RY);

                Height += graph.Height + 2;
                prev = graph;
                Width = Math.Max(Width, graph.Width + _block.Width / 2);
            }
            Height += 2;
        }
Exemplo n.º 3
0
        private List<Block> _preBuildBranch(IEnumerable<COperator> operators, out Size s)
        {
            s = new Size();
            List<Block> branch = new List<Block>();
            if (operators == null) return branch;
            foreach (COperator o in operators)
            {
                var graph = new GraphicOperator(o);
                if (graph.Width > s.Width)
                    s.Width = graph.Width;
                s.Height += graph.Height + 2;
                branch.Add(graph);
            }

            return branch;
        }