Last change
on this file since 10550 was
10520,
checked in by bburlacu, 10 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
|
Line | |
---|
1 |
|
---|
2 | using System;
|
---|
3 | using System.Collections.Generic;
|
---|
4 | using System.Drawing;
|
---|
5 |
|
---|
6 | namespace 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; }
|
---|
12 |
|
---|
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();
|
---|
18 |
|
---|
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; }
|
---|
23 |
|
---|
24 | IEnumerable<VisualTreeNode<T>> GetVisualNodes();
|
---|
25 | Dictionary<T, PointF> GetCoordinates();
|
---|
26 | }
|
---|
27 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.