Changeset 9650
- Timestamp:
- 06/22/13 11:23:29 (11 years ago)
- 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 41 41 <DebugType>full</DebugType> 42 42 <Optimize>false</Optimize> 43 <OutputPath> $(SolutionDir)\bin\</OutputPath>43 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 44 44 <DefineConstants>DEBUG;TRACE</DefineConstants> 45 45 <ErrorReport>prompt</ErrorReport> … … 50 50 <DebugType>pdbonly</DebugType> 51 51 <Optimize>true</Optimize> 52 <OutputPath> $(SolutionDir)\bin\</OutputPath>52 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 53 53 <DefineConstants>TRACE</DefineConstants> 54 54 <ErrorReport>prompt</ErrorReport> … … 58 58 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> 59 59 <DebugSymbols>true</DebugSymbols> 60 <OutputPath> $(SolutionDir)\bin\</OutputPath>60 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 61 61 <DefineConstants>DEBUG;TRACE</DefineConstants> 62 62 <DebugType>full</DebugType> … … 66 66 </PropertyGroup> 67 67 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> 68 <OutputPath> $(SolutionDir)\bin\</OutputPath>68 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 69 69 <DefineConstants>TRACE</DefineConstants> 70 70 <Optimize>true</Optimize> … … 76 76 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 77 77 <DebugSymbols>true</DebugSymbols> 78 <OutputPath> $(SolutionDir)\bin\</OutputPath>78 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 79 79 <DefineConstants>DEBUG;TRACE</DefineConstants> 80 80 <DebugType>full</DebugType> … … 84 84 </PropertyGroup> 85 85 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> 86 <OutputPath> $(SolutionDir)\bin\</OutputPath>86 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 87 87 <DefineConstants>TRACE</DefineConstants> 88 88 <Optimize>true</Optimize> … … 93 93 </PropertyGroup> 94 94 <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> 95 151 <Reference Include="System" /> 96 152 <Reference Include="System.Core"> … … 160 216 <DependentUpon>SymbolicExpressionView.cs</DependentUpon> 161 217 </Compile> 218 <Compile Include="TreeLayout.cs" /> 162 219 <Compile Include="VisualSymbolicExpressionTreeNode.cs" /> 163 220 <Compile Include="VisualSymbolicExpressionTreeNodeConnection.cs" /> 164 221 </ItemGroup> 165 222 <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>201 223 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj"> 202 224 <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project> … … 204 226 <Private>False</Private> 205 227 </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>221 228 <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj"> 222 229 <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project> 223 230 <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>244 231 <Private>False</Private> 245 232 </ProjectReference> … … 267 254 </BootstrapperPackage> 268 255 </ItemGroup> 256 <ItemGroup> 257 <EmbeddedResource Include="SymbolicExpressionTreeChart.resx"> 258 <DependentUpon>SymbolicExpressionTreeChart.cs</DependentUpon> 259 </EmbeddedResource> 260 </ItemGroup> 269 261 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 270 262 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. … … 276 268 --> 277 269 <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) 279 271 set ProjectDir=$(ProjectDir) 280 272 set SolutionDir=$(SolutionDir) … … 283 275 call PreBuildEvent.cmd 284 276 </PreBuildEvent> 285 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">277 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 286 278 export ProjectDir=$(ProjectDir) 287 279 export SolutionDir=$(SolutionDir) -
branches/HeuristicLab.TreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.Designer.cs
r9456 r9650 70 70 // 71 71 this.saveFileDialog.Filter = "Bitmap (*.bmp)|*.bmp|EMF (*.emf)|*.emf"; 72 this.saveFileDialog.FilterIndex = 1;72 // 73 73 // SymbolicExpressionTreeChart 74 74 // 75 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);76 75 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 77 76 this.ContextMenuStrip = this.contextMenuStrip; 77 this.DoubleBuffered = true; 78 78 this.Name = "SymbolicExpressionTreeChart"; 79 79 this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseClick); -
branches/HeuristicLab.TreeLayout/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs
r9587 r9650 25 25 using System.Drawing.Imaging; 26 26 using System.Windows.Forms; 27 using Point = System.Drawing.Point; 27 28 28 29 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { … … 48 49 } 49 50 51 #region Public properties 50 52 private int spacing; 51 53 public int Spacing { … … 106 108 set { suspendRepaint = value; } 107 109 } 110 #endregion 108 111 109 112 protected override void OnPaint(PaintEventArgs e) { … … 250 253 251 254 #region methods for painting the symbolic expression tree 255 252 256 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 } 254 311 } 255 312 … … 257 314 /// 258 315 /// </summary> 259 /// <param name=" functionTree">function tree to draw</param>316 /// <param name="node">the root of the function tree to draw</param> 260 317 /// <param name="graphics">graphics object to draw on</param> 261 318 /// <param name="x">x coordinate of drawing area</param> … … 365 422 } 366 423 #endregion 367 368 424 #region save image 369 425 private void saveImageToolStripMenuItem_Click(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.