Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/28/14 11:56:15 (10 years ago)
Author:
bburlacu
Message:

#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:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionGrammarAllowedChildSymbolsControl.cs

    r9456 r10520  
    2929using HeuristicLab.PluginInfrastructure;
    3030
     31using VisualSymbolicExpressionTreeNode = HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.VisualTreeNode<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTreeNode>;
     32
    3133namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
    3234  public sealed partial class SymbolicExpressionGrammarAllowedChildSymbolsControl : UserControl {
     
    162164
    163165      VisualSymbolicExpressionTreeNode clickedNode = (VisualSymbolicExpressionTreeNode)sender;
    164       var selectedNode = clickedNode.SymbolicExpressionTreeNode;
     166      var selectedNode = clickedNode.Content;
    165167      if (selectedNode.SubtreeCount == 0) {
    166168        if (!selectedSymbolicExpressionTreeNodes.Contains(selectedNode))
     
    207209        var visualNode = symbolicExpressionTreeChart.FindVisualSymbolicExpressionTreeNodeAt(coordinates.X, coordinates.Y);
    208210        if (visualNode != null) {
    209           var node = visualNode.SymbolicExpressionTreeNode;
     211          var node = visualNode.Content;
    210212          var root = symbolicExpressionTreeChart.Tree.Root;
    211213          if (node == root || node.Parent == root) e.Effect = DragDropEffects.Copy;
     
    223225      var symbols = data as IEnumerable<ISymbol>;
    224226
    225       if (node.SymbolicExpressionTreeNode == root) {
     227      if (node.Content == root) {
    226228        if (symbol != null)
    227229          Grammar.AddAllowedChildSymbol(root.Symbol, symbol);
     
    229231          foreach (var s in symbols) Grammar.AddAllowedChildSymbol(root.Symbol, s);
    230232      } else {
    231         int argumentIndex = root.IndexOfSubtree(node.SymbolicExpressionTreeNode);
     233        int argumentIndex = root.IndexOfSubtree(node.Content);
    232234        if (symbol != null)
    233235          Grammar.AddAllowedChildSymbol(root.Symbol, symbol, argumentIndex);
Note: See TracChangeset for help on using the changeset viewer.