source: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/LayoutEngines/ILayoutEngine.cs @ 10520

Last change on this file since 10520 was 10520, checked in by bburlacu, 7 years ago

#2076: Got rid of layout adapters. Extracted the previous drawing code and made it into another layout engine called the BoxesLayoutEngine (because it divides the areas necessary for each subtree into boxes and recursively applies the layout). Simplified usage of layout engine so that most of the things are handled internally, and the user just has to provide some lambdas telling the engine how to navigate the original tree. Added context option in the SymbolicExpressionTreeChart to choose which layout engine to use for tree drawing. Moved the SymbolicExpressionTreeLatexFormatter to the HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views assembly because it depends on the layout engine.

File size: 914 bytes
2using System;
3using System.Collections.Generic;
4using System.Drawing;
6namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
7  interface ILayoutEngine<T> where T : class {
8    int NodeWidth { get; set; }
9    int NodeHeight { get; set; }
10    int HorizontalSpacing { get; set; }
11    int VerticalSpacing { get; set; }
13    void CalculateLayout();
14    void CalculateLayout(float width, float height);
15    void Initialize(T root, Func<T, IEnumerable<T>> getChildren, Func<T, int> getLength = null, Func<T, int> getDepth = null);
16    void Clear();
17    void Reset();
19    // function members necessary to navigate the tree structure
20    Func<T, IEnumerable<T>> GetChildren { get; set; }
21    Func<T, int> GetLength { get; set; }
22    Func<T, int> GetDepth { get; set; }
24    IEnumerable<VisualTreeNode<T>> GetVisualNodes();
25    Dictionary<T, PointF> GetCoordinates();
26  }
Note: See TracBrowser for help on using the repository browser.