Beispiel #1
0
        public void Paint(DimensionHierarchy hierarchy, GridPosition startPosition, GridOrientation orientation)
        {
            var placement = new ZigZagPlacement(startPosition, orientation);

            for (int level = 0; level < hierarchy.LevelCount; ++level)
            {
                var previousMeasurement = new object();
                var currentItem         = default(UIElement);
                for (int keyIndex = 0; keyIndex < hierarchy.KeyCount; ++keyIndex)
                {
                    var measurement = hierarchy.Keys[keyIndex].Measurements[level];
                    if (!Equals(previousMeasurement, measurement))
                    {
                        currentItem = _itemFactory.CreateHeaderItem(measurement);
                        _grid.Children.Add(currentItem);
                        if (keyIndex > 0)
                        {
                            placement.NextSlot();
                        }
                        placement.ApplySlot(currentItem);
                    }
                    else
                    {
                        placement.ExtendSlot();
                        placement.ApplySlot(currentItem);
                    }
                    previousMeasurement = measurement;
                }
                placement.NextLevel();
            }
        }
Beispiel #2
0
        public void Paint(
            DimensionHierarchy horizontalHierarchy,
            DimensionHierarchy verticalHierarchy,
            GridPosition startPosition)
        {
            var placement = new ZigZagPlacement(startPosition, GridOrientation.Horizontal);

            foreach (var verticalFactKey in verticalHierarchy.Keys)
            {
                foreach (var horizontalFactKey in horizontalHierarchy.Keys)
                {
                    var factKey  = horizontalFactKey.Merge(verticalFactKey);
                    var fact     = FindFact(factKey);
                    var factItem = _itemFactory.CreateFactItem(fact);
                    _grid.Children.Add(factItem);
                    placement.ApplySlot(factItem);
                    placement.NextSlot();
                }
                placement.NextLevel();
            }
        }
 public GridSpaceAllocator(Grid grid, DimensionHierarchy horizontalHierarchy, DimensionHierarchy verticalHierarchy)
 {
     _grid = grid;
     _horizontalHierarchy = horizontalHierarchy;
     _verticalHierarchy   = verticalHierarchy;
 }