示例#1
0
        /// <summary>
        /// save as bmp file
        /// </summary>
        /// <param name="n"></param>
        /// <returns>Bitmap of current Node and children</returns>
        public Bitmap drawTree(Node n)
        {
            Bitmap   b;
            Graphics g;

            Options.OptionsData d = Options.OptionsData.Instance;
            // set drawing options
            justification       = d.Justification;
            join                = d.Join;
            treeOrientation     = d.TreeOrientation;
            useRnotation        = d.Notation;
            dropShadow          = d.DropShadow;
            boxShading          = d.BoxShading;
            showLegend          = d.ShowLegend;
            arrows              = d.Arrow;
            marker              = d.Marker;
            helpersAsCoPremises = d.HelpersAsCoPremises;
            // Width and height calculation should only be a cross check
            maxWidth  = 0;
            maxHeight = 0;

            recalc(n);

            b = new Bitmap((int)maxWidth + 20, (int)maxHeight + 20); // 20 pixel border
            g = Graphics.FromImage(b);                               // gets the graphics drawing object
            g.Clear(Color.White);                                    // clears the background
            drawTree(g, n);

            return(b);
        }
示例#2
0
        /// <summary>
        /// Draws the tree from the specified node
        /// </summary>
        /// <param name="g">The Drawing GDI object</param>
        /// <param name="n">Root Node</param>
        public void drawTree(Graphics g, Node n)
        {
            graphics = g;

            Options.OptionsData d = Options.OptionsData.Instance;
            // set drawing options
            justification       = d.Justification;
            join                = d.Join;
            treeOrientation     = d.TreeOrientation;
            useRnotation        = d.Notation;
            dropShadow          = d.DropShadow;
            boxShading          = d.BoxShading;
            showLegend          = d.ShowLegend;
            arrows              = d.Arrow;
            marker              = d.Marker;
            helpersAsCoPremises = d.HelpersAsCoPremises;
            // Width and height calculation should only be a cross check
            maxWidth    = 0;
            maxHeight   = 0;
            g.PageScale = zoom;

            // if(needsRecalc)
            recalc(n);

            // calcStartXY(n,ref x,ref y);

            // for debug
            // g.DrawRectangle(new Pen(Color.Bisque),0,0,maxWidth,maxHeight);
            // g.DrawString("maxHeight & maxWidth:"+maxWidth+" : "+maxHeight,new Font("Courier",8F),new SolidBrush(Color.Black),offsetX,offsetY+maxHeight+margin);

            drawNode(n.x, n.y, n, 0);

            legendY = maxHeight - legendHeight;
            drawLegend(n, true);
        }
示例#3
0
        /// <summary>
        /// New drawing object for the argument map
        /// </summary>
        /// <param name="offsetX">Offset from the left</param>
        /// <param name="offsetY">Offset from the top</param>
        /// <param name="zoom">Magnification</param>
        public DrawTree(float offsetX, float offsetY, float zoom)
        {
            // Create font and brush.
            drawFont      = new Font("Arial", 16);
            drawFontSmall = new Font("Arial", 8);
            drawBrush     = new SolidBrush(Color.Black);

            justification       = justificationType.jCentre;
            join                = joinType.dogleg;
            arrows              = arrowType.none;
            marker              = markerType.none;
            helpersAsCoPremises = false;

            this.offsetX = offsetX; this.offsetY = offsetY;
            this.zoom    = zoom;
            System.Diagnostics.Debug.Assert(zoom > 0F, "Zoom cannot be zero or less");
        }