Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9650


Ignore:
Timestamp:
06/22/13 11:23:29 (11 years ago)
Author:
bburlacu
Message:

#2076: Created branch and committed first version of the implementation.

Location:
branches/HeuristicLab.TreeLayout
Files:
2 added
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.csproj

    r8600 r9650  
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     43    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
     
    5050    <DebugType>pdbonly</DebugType>
    5151    <Optimize>true</Optimize>
    52     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     52    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    5353    <DefineConstants>TRACE</DefineConstants>
    5454    <ErrorReport>prompt</ErrorReport>
     
    5858  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    5959    <DebugSymbols>true</DebugSymbols>
    60     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     60    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    6161    <DefineConstants>DEBUG;TRACE</DefineConstants>
    6262    <DebugType>full</DebugType>
     
    6666  </PropertyGroup>
    6767  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    68     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     68    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    6969    <DefineConstants>TRACE</DefineConstants>
    7070    <Optimize>true</Optimize>
     
    7676  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    7777    <DebugSymbols>true</DebugSymbols>
    78     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     78    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    7979    <DefineConstants>DEBUG;TRACE</DefineConstants>
    8080    <DebugType>full</DebugType>
     
    8484  </PropertyGroup>
    8585  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    86     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     86    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    8787    <DefineConstants>TRACE</DefineConstants>
    8888    <Optimize>true</Optimize>
     
    9393  </PropertyGroup>
    9494  <ItemGroup>
     95    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     96      <SpecificVersion>False</SpecificVersion>
     97      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     98    </Reference>
     99    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     100      <SpecificVersion>False</SpecificVersion>
     101      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     102    </Reference>
     103    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     104      <SpecificVersion>False</SpecificVersion>
     105      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     106    </Reference>
     107    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     108      <SpecificVersion>False</SpecificVersion>
     109      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     110    </Reference>
     111    <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     112      <SpecificVersion>False</SpecificVersion>
     113      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
     114    </Reference>
     115    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     116      <SpecificVersion>False</SpecificVersion>
     117      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     118    </Reference>
     119    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     120      <SpecificVersion>False</SpecificVersion>
     121      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
     122    </Reference>
     123    <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     124      <SpecificVersion>False</SpecificVersion>
     125      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
     126    </Reference>
     127    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     128      <SpecificVersion>False</SpecificVersion>
     129      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
     130    </Reference>
     131    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     132      <SpecificVersion>False</SpecificVersion>
     133      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
     134    </Reference>
     135    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     136      <SpecificVersion>False</SpecificVersion>
     137      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     138    </Reference>
     139    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     140      <SpecificVersion>False</SpecificVersion>
     141      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     142    </Reference>
     143    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     144      <SpecificVersion>False</SpecificVersion>
     145      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     146    </Reference>
     147    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     148      <SpecificVersion>False</SpecificVersion>
     149      <HintPath>..\..\..\..\Trunk\sources\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
     150    </Reference>
    95151    <Reference Include="System" />
    96152    <Reference Include="System.Core">
     
    160216      <DependentUpon>SymbolicExpressionView.cs</DependentUpon>
    161217    </Compile>
     218    <Compile Include="TreeLayout.cs" />
    162219    <Compile Include="VisualSymbolicExpressionTreeNode.cs" />
    163220    <Compile Include="VisualSymbolicExpressionTreeNodeConnection.cs" />
    164221  </ItemGroup>
    165222  <ItemGroup>
    166     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    167       <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
    168       <Name>HeuristicLab.Collections-3.3</Name>
    169       <Private>False</Private>
    170     </ProjectReference>
    171     <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
    172       <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
    173       <Name>HeuristicLab.Common.Resources-3.3</Name>
    174       <Private>False</Private>
    175     </ProjectReference>
    176     <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    177       <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
    178       <Name>HeuristicLab.Common-3.3</Name>
    179       <Private>False</Private>
    180     </ProjectReference>
    181     <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
    182       <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
    183       <Name>HeuristicLab.Core.Views-3.3</Name>
    184       <Private>False</Private>
    185     </ProjectReference>
    186     <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    187       <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
    188       <Name>HeuristicLab.Core-3.3</Name>
    189       <Private>False</Private>
    190     </ProjectReference>
    191     <ProjectReference Include="..\..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj">
    192       <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project>
    193       <Name>HeuristicLab.Data.Views-3.3</Name>
    194       <Private>False</Private>
    195     </ProjectReference>
    196     <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    197       <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
    198       <Name>HeuristicLab.Data-3.3</Name>
    199       <Private>False</Private>
    200     </ProjectReference>
    201223    <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
    202224      <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project>
     
    204226      <Private>False</Private>
    205227    </ProjectReference>
    206     <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
    207       <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
    208       <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>
    209       <Private>False</Private>
    210     </ProjectReference>
    211     <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">
    212       <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
    213       <Name>HeuristicLab.MainForm-3.3</Name>
    214       <Private>False</Private>
    215     </ProjectReference>
    216     <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    217       <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
    218       <Name>HeuristicLab.Operators-3.3</Name>
    219       <Private>False</Private>
    220     </ProjectReference>
    221228    <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">
    222229      <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project>
    223230      <Name>HeuristicLab.Optimization.Views-3.3</Name>
    224       <Private>False</Private>
    225     </ProjectReference>
    226     <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    227       <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
    228       <Name>HeuristicLab.Optimization-3.3</Name>
    229       <Private>False</Private>
    230     </ProjectReference>
    231     <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    232       <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    233       <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    234       <Private>False</Private>
    235     </ProjectReference>
    236     <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
    237       <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
    238       <Name>HeuristicLab.Random-3.3</Name>
    239       <Private>False</Private>
    240     </ProjectReference>
    241     <ProjectReference Include="..\..\HeuristicLab.Visualization.ChartControlsExtensions\3.3\HeuristicLab.Visualization.ChartControlsExtensions-3.3.csproj">
    242       <Project>{315BDA09-3F4F-49B3-9790-B37CFC1C5750}</Project>
    243       <Name>HeuristicLab.Visualization.ChartControlsExtensions-3.3</Name>
    244231      <Private>False</Private>
    245232    </ProjectReference>
     
    267254    </BootstrapperPackage>
    268255  </ItemGroup>
     256  <ItemGroup>
     257    <EmbeddedResource Include="SymbolicExpressionTreeChart.resx">
     258      <DependentUpon>SymbolicExpressionTreeChart.cs</DependentUpon>
     259    </EmbeddedResource>
     260  </ItemGroup>
    269261  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    270262  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
     
    276268  -->
    277269  <PropertyGroup>
    278    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     270    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    279271set ProjectDir=$(ProjectDir)
    280272set SolutionDir=$(SolutionDir)
     
    283275call PreBuildEvent.cmd
    284276</PreBuildEvent>
    285 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     277    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    286278export ProjectDir=$(ProjectDir)
    287279export SolutionDir=$(SolutionDir)
  • branches/HeuristicLab.TreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.Designer.cs

    r9456 r9650  
    7070      //
    7171      this.saveFileDialog.Filter = "Bitmap (*.bmp)|*.bmp|EMF (*.emf)|*.emf";
    72       this.saveFileDialog.FilterIndex = 1;
     72      //
    7373      // SymbolicExpressionTreeChart
    7474      //
    75       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    7675      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    7776      this.ContextMenuStrip = this.contextMenuStrip;
     77      this.DoubleBuffered = true;
    7878      this.Name = "SymbolicExpressionTreeChart";
    7979      this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseClick);
  • branches/HeuristicLab.TreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs

    r9587 r9650  
    2525using System.Drawing.Imaging;
    2626using System.Windows.Forms;
     27using Point = System.Drawing.Point;
    2728
    2829namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
     
    4849    }
    4950
     51    #region Public properties
    5052    private int spacing;
    5153    public int Spacing {
     
    106108      set { suspendRepaint = value; }
    107109    }
     110    #endregion
    108111
    109112    protected override void OnPaint(PaintEventArgs e) {
     
    250253
    251254    #region methods for painting the symbolic expression tree
     255
    252256    private void DrawFunctionTree(ISymbolicExpressionTree tree, Graphics graphics, int x, int y, int width, int height) {
    253       DrawFunctionTree(tree.Root, graphics, x, y, width, height, Point.Empty);
     257      //      DrawFunctionTree(tree.Root, graphics, x, y, width, height, Point.Empty);
     258      AlternateDraw(tree, graphics, 70, 46, 20, 50);
     259    }
     260
     261    private void AlternateDraw(ISymbolicExpressionTree tree, Graphics graphics, int preferredWidth, int preferredHeight, int minDistance, int maxDistance) {
     262      var tl = new TreeLayout();
     263      tl.Distance = 5;
     264      tl.SymbolicExpressionTree = tree;
     265
     266      var nodePositions = tl.GetNodeCoordinates();
     267      var bounds = tl.Bounds();
     268
     269      double sx = Width / bounds.Width;
     270      double sy = Height / bounds.Height;
     271
     272      double dx = tl.Distance * sx; // scaled horizontal distance
     273      double dy = tl.Distance * sy; // scaled vertical distance
     274
     275      int maxWidth = (int)Math.Round(dx);
     276      int maxHeight = (int)Math.Round(dy);
     277
     278      // instead of using the preferred with/height of each node inside the foreach loop below,
     279      // we assume the same width/height for all nodes
     280      int w = Math.Min(preferredWidth, maxWidth - minDistance / 2);
     281      int h = Math.Min(preferredHeight, maxHeight - minDistance / 2);
     282      // adjust scaling factor so that nodes will be at most maxDistance far from each other on the horizontal axis
     283      double offset = 0;
     284      if (maxDistance + w < maxWidth) {
     285        sx *= (double)(maxDistance + w) / maxWidth;
     286        offset = (Width - (sx * bounds.Width)) / 2;
     287      }
     288      foreach (var node in visualTreeNodes.Keys) {
     289        var visualNode = visualTreeNodes[node];
     290        var pos = nodePositions[node];
     291        visualNode.Width = w;
     292        visualNode.Height = h;
     293        visualNode.X = (int)Math.Round(pos.X * sx + offset); ;
     294        visualNode.Y = (int)Math.Round(pos.Y * sy);
     295        DrawTreeNode(graphics, visualNode);
     296      }
     297      graphics.ResetClip(); // reset clip region
     298      foreach (var visualNode in visualTreeNodes.Values) {
     299        var node = visualNode.SymbolicExpressionTreeNode;
     300        foreach (var subtree in node.Subtrees) {
     301          var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(node, subtree);
     302          var visualSubtree = visualTreeNodes[subtree];
     303          var origin = new Point(visualNode.X + visualNode.Width / 2, visualNode.Y + visualNode.Height);
     304          var target = new Point(visualSubtree.X + visualSubtree.Width / 2, visualSubtree.Y);
     305          using (var linePen = new Pen(visualLine.LineColor)) {
     306            linePen.DashStyle = visualLine.DashStyle;
     307            graphics.DrawLine(linePen, origin, target);
     308          }
     309        }
     310      }
    254311    }
    255312
     
    257314    ///
    258315    /// </summary>
    259     /// <param name="functionTree"> function tree to draw</param>
     316    /// <param name="node">the root of the function tree to draw</param>
    260317    /// <param name="graphics">graphics object to draw on</param>
    261318    /// <param name="x">x coordinate of drawing area</param>
     
    365422    }
    366423    #endregion
    367 
    368424    #region save image
    369425    private void saveImageToolStripMenuItem_Click(object sender, EventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.