Example #1
0
        public virtual void LogicalLayoutLeaf(AlignerOptions options)
        {
            OptionsAndLayout(options);
            var display = this.CurrentDisplay;

            if (display != null)
            {
                var selected = display.Data.Selected.Elements;
                var root     = display.Data.Focused;
                if (selected.Count() == 1)
                {
                    var walk = display.Data.Graph.Walk()
                               .DeepWalk(root, 0, Walk.Leafs <IVisual, IVisualEdge> ())
                               .Where(l => !(l.Node is IVisualEdge))
                               .ToArray();

                    var save = options.Collisions;

                    Call(CurrentDisplay, (aligner, items) => {
                        var bounds         = new Rectangle(aligner.Locator.GetLocation(root), aligner.Locator.GetSize(root));
                        options.Collisions = Collisions.None;
                        var cols           = aligner.MeasureWalk(walk, ref bounds, options);
                        aligner.DequeColumn(cols, ref bounds, options);
                        options.Collisions = Collisions.NextFree | Collisions.PerColumn | Collisions.Toggle;
                        aligner.LocateColumns(cols, bounds, options);
                    }
                         , walk.Select(l => l.Node));
                    options.Collisions = save;
                }
            }
        }
Example #2
0
 /// <summary>
 /// an expandwalk with leafs of thing
 /// attention! use it only once, or make tolist or toarray
 /// </summary>
 /// <param name="thing"></param>
 /// <returns></returns>
 public IEnumerable <IThing> Leafs(IThing thing)
 {
     return(ThingGraph.Walk()
            .ExpandWalk(thing, 0, Walk.Leafs <IThing, ILink> ())
            .Where(item => !(item.Node is ILink || item.Node == thing))
            .Select(item => item.Node));
 }