public TreemapGenerator()
 {
     this.m_oNodes = new Nodes(null);
     this.m_oNodes.TreemapGenerator = this;
     this.m_iPaddingPx = 5;
     this.m_iPaddingDecrementPerLevelPx = 1;
     this.m_iPenWidthPx = 3;
     this.m_iPenWidthDecrementPerLevelPx = 1;
     this.m_oBackColor                  = SystemColors.Window;
     this.m_oBorderColor                = SystemColors.WindowFrame;
     this.m_eNodeColorAlgorithm         = NodeColorAlgorithm.UseColorMetric;
     this.m_oMinColor                   = Color.Red;
     this.m_oMaxColor                   = Color.Green;
     this.m_fMinColorMetric             = -100f;
     this.m_fMaxColorMetric             = 100f;
     this.m_iDiscretePositiveColors     = 20;
     this.m_iDiscreteNegativeColors     = 20;
     this.m_sFontFamily                 = "Arial";
     this.m_fFontMinSizePt              = 8f;
     this.m_fFontMaxSizePt              = 100f;
     this.m_fFontIncrementPt            = 2f;
     this.m_oFontSolidColor             = SystemColors.WindowText;
     this.m_iFontMinAlpha               = 105;
     this.m_iFontMaxAlpha               = 255;
     this.m_iFontAlphaIncrementPerLevel = 50;
     this.m_oSelectedFontColor          = SystemColors.HighlightText;
     this.m_oSelectedBackColor          = SystemColors.Highlight;
     this.m_iNodeLevelsWithText         = NodeLevelsWithText.All;
     this.m_iMinNodeLevelWithText       = 0;
     this.m_iMaxNodeLevelWithText       = 999;
     this.m_eTextLocation               = TextLocation.Top;
     this.m_eEmptySpaceLocation         = EmptySpaceLocation.DeterminedByLayoutAlgorithm;
     this.m_oSelectedNode               = null;
     this.m_oSavedSelectedNodeBitmap    = null;
     this.m_bInBeginUpdate              = false;
     this.m_eLayoutAlgorithm            = LayoutAlgorithm.BottomWeightedSquarified;
 }
 public override void CalculateNodeRectangles(Nodes oNodes, RectangleF oParentRectangle, Node oParentNode, EmptySpaceLocation eEmptySpaceLocation)
 {
     Debug.Assert(oNodes != null);
     Debug.Assert(oParentRectangle.Width > 0f);
     Debug.Assert(oParentRectangle.Height > 0f);
     if (oNodes.Count != 0)
     {
         Node[] array             = oNodes.ToArraySortedBySizeMetric();
         double areaPerSizeMetric = this.GetAreaPerSizeMetric(oNodes, oParentRectangle, oParentNode);
         if (areaPerSizeMetric == 0.0)
         {
             base.SetNodeRectanglesToEmpty(oNodes, true);
         }
         else
         {
             if (eEmptySpaceLocation == EmptySpaceLocation.Top && oNodes.EmptySpace.SizeMetric > 0f)
             {
                 double num = areaPerSizeMetric * (double)oNodes.EmptySpace.SizeMetric;
                 Debug.Assert(oParentRectangle.Width > 0f);
                 double num2 = num / (double)oParentRectangle.Width;
                 oParentRectangle = RectangleF.FromLTRB(oParentRectangle.Left, oParentRectangle.Top + (float)num2, oParentRectangle.Right, oParentRectangle.Bottom);
                 if (oParentRectangle.Height <= 0f)
                 {
                     base.SetNodeRectanglesToEmpty(oNodes, true);
                     return;
                 }
             }
             this.CalculateSquarifiedNodeRectangles(array, oParentRectangle, areaPerSizeMetric);
             Node[] array2 = array;
             for (int i = 0; i < array2.Length; i++)
             {
                 Node       node      = array2[i];
                 RectangleF rectangle = node.Rectangle;
                 Debug.Assert(rectangle.Width >= 0f);
                 Debug.Assert(rectangle.Height >= 0f);
             }
         }
     }
 }
Exemple #3
0
 public abstract void CalculateNodeRectangles(Nodes oNodes, RectangleF oParentRectangle, Node oParentNode, EmptySpaceLocation eEmptySpaceLocation);
        public override void CalculateNodeRectangles(Nodes oNodes, RectangleF oParentRectangle, Node oParentNode, EmptySpaceLocation eEmptySpaceLocation)
        {
            Debug.Assert(oNodes != null);
            Debug.Assert(oParentRectangle.Width > 0f);
            Debug.Assert(oParentRectangle.Height > 0f);
            if (oNodes.Count == 0)
            {
                return;
            }
            Node[] array             = oNodes.ToArraySortedBySizeMetric();
            double areaPerSizeMetric = GetAreaPerSizeMetric(oNodes, oParentRectangle);

            if (areaPerSizeMetric == 0.0)
            {
                SetNodeRectanglesToEmpty(oNodes, bRecursive: true);
                return;
            }
            if (eEmptySpaceLocation == EmptySpaceLocation.Top && oNodes.EmptySpace.SizeMetric > 0f)
            {
                double num = areaPerSizeMetric * (double)oNodes.EmptySpace.SizeMetric;
                Debug.Assert(oParentRectangle.Width > 0f);
                double num2 = num / (double)oParentRectangle.Width;
                oParentRectangle = RectangleF.FromLTRB(oParentRectangle.Left, oParentRectangle.Top + (float)num2, oParentRectangle.Right, oParentRectangle.Bottom);
                if (oParentRectangle.Height <= 0f)
                {
                    SetNodeRectanglesToEmpty(oNodes, bRecursive: true);
                    return;
                }
            }
            CalculateSquarifiedNodeRectangles(array, oParentRectangle, areaPerSizeMetric);
            Node[] array2 = array;
            foreach (Node node in array2)
            {
                RectangleF rectangle = node.Rectangle;
                Debug.Assert(rectangle.Width >= 0f);
                Debug.Assert(rectangle.Height >= 0f);
            }
        }