protected override void ComputeNextPosition(RowOrientation orientation, ref double xPos, ref double yPos, double width, double height)
 {
     if (orientation == RowOrientation.Horizontal)
         yPos += height;
     else
         xPos += width;
 }
 protected override Rect GetRectangle(RowOrientation orientation, TreeMapItem item, double x, double y, double width, double height)
 {
     if (orientation == RowOrientation.Horizontal)
         return new Rect(x, y, width, item.RealArea / width);
     else
         return new Rect(x, y, item.RealArea / height, height);
 }
 protected virtual void ComputeNextPosition(RowOrientation orientation, ref double xPos, ref double yPos, double width, double height)
 {
     if (orientation == RowOrientation.Horizontal)
         xPos += width;
     else
         yPos += height;
 }
 protected virtual void ComputeNextPosition(RowOrientation orientation, ref double xPos, ref double yPos, double width, double height)
 {
     if (orientation == RowOrientation.Horizontal)
     {
         xPos += width;
     }
     else
     {
         yPos += height;
     }
 }
 protected virtual Rect GetRectangle(RowOrientation orientation, WeightUIElement item, double x, double y, double width, double height)
 {
     if (orientation == RowOrientation.Horizontal)
     {
         return(new Rect(x, y, item.RealArea / height, height));
     }
     else
     {
         return(new Rect(x, y, width, item.RealArea / width));
     }
 }
Example #6
0
        public static RowOrientation GetRowOrientation(string value)
        {
            RowOrientation rowOrientation = RowOrientation.Unknown;

            if (value.Equals("North"))
            {
                rowOrientation = RowOrientation.North;
            }
            else if (value.Equals("South"))
            {
                rowOrientation = RowOrientation.South;
            }

            return(rowOrientation);
        }
        protected void ComputeTreeMaps(List <WeightUIElement> items)
        {
            RowOrientation orientation = this.GetOrientation();

            double areaSum = 0;

            foreach (WeightUIElement item in items)
            {
                areaSum += item.RealArea;
            }

            Rect currentRow;

            if (orientation == RowOrientation.Horizontal)
            {
                currentRow = new Rect(_emptyArea.X, _emptyArea.Y, areaSum / _emptyArea.Height, _emptyArea.Height);
                _emptyArea = new Rect(_emptyArea.X + currentRow.Width, _emptyArea.Y, Math.Max(0, _emptyArea.Width - currentRow.Width), _emptyArea.Height);
            }
            else
            {
                currentRow = new Rect(_emptyArea.X, _emptyArea.Y, _emptyArea.Width, areaSum / _emptyArea.Width);
                _emptyArea = new Rect(_emptyArea.X, _emptyArea.Y + currentRow.Height, _emptyArea.Width, Math.Max(0, _emptyArea.Height - currentRow.Height));
            }

            double prevX = currentRow.X;
            double prevY = currentRow.Y;

            foreach (WeightUIElement item in items)
            {
                Rect rect = this.GetRectangle(orientation, item, prevX, prevY, currentRow.Width, currentRow.Height);

                item.AspectRatio      = rect.Width / rect.Height;
                item.ComputedSize     = rect.Size;
                item.ComputedLocation = rect.Location;

                this.ComputeNextPosition(orientation, ref prevX, ref prevY, rect.Width, rect.Height);
            }
        }
 protected virtual Rect GetRectangle(RowOrientation orientation, WeightUIElement item, double x, double y, double width, double height)
 {
   if (orientation == RowOrientation.Horizontal)
     return new Rect(x, y, item.RealArea / height, height);
   else
     return new Rect(x, y, width, item.RealArea / width);
 }