Changeset 6036
- Timestamp:
- 04/21/11 17:16:50 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 8 added
- 13 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab 3.3.sln
r5944 r6036 394 394 EndProject 395 395 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Tests-3.4", "HeuristicLab.Problems.DataAnalysis\3.4\Tests\HeuristicLab.Problems.DataAnalysis.Tests-3.4.csproj", "{F5013F6B-5A2D-4741-8FC9-31A6968E9C41}" 396 EndProject 397 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Operators.Views.GraphVisualization.Views-3.3", "HeuristicLab.Operators.Views.GraphVisualization.Views\3.3\HeuristicLab.Operators.Views.GraphVisualization.Views-3.3.csproj", "{0C39A349-1979-419A-89BD-E4E2F26BD287}" 396 398 EndProject 397 399 Global … … 1836 1838 {F5013F6B-5A2D-4741-8FC9-31A6968E9C41}.Release|x86.ActiveCfg = Release|x86 1837 1839 {F5013F6B-5A2D-4741-8FC9-31A6968E9C41}.Release|x86.Build.0 = Release|x86 1840 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 1841 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Debug|Any CPU.Build.0 = Debug|Any CPU 1842 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Debug|x64.ActiveCfg = Debug|x64 1843 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Debug|x64.Build.0 = Debug|x64 1844 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Debug|x86.ActiveCfg = Debug|x86 1845 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Debug|x86.Build.0 = Debug|x86 1846 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Release|Any CPU.ActiveCfg = Release|Any CPU 1847 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Release|Any CPU.Build.0 = Release|Any CPU 1848 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Release|x64.ActiveCfg = Release|x64 1849 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Release|x64.Build.0 = Release|x64 1850 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Release|x86.ActiveCfg = Release|x86 1851 {0C39A349-1979-419A-89BD-E4E2F26BD287}.Release|x86.Build.0 = Release|x86 1838 1852 EndGlobalSection 1839 1853 GlobalSection(SolutionProperties) = preSolution -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/GraphVisualizationInfoView.Designer.cs
r6034 r6036 20 20 #endregion 21 21 22 namespace HeuristicLab.Operators.Views.GraphVisualization {22 namespace HeuristicLab.Operators.Views.GraphVisualization.Views { 23 23 partial class GraphVisualizationInfoView { 24 24 /// <summary> … … 70 70 this.graphVisualization.OnEntityRemoved += new System.EventHandler<global::Netron.Diagramming.Core.EntityEventArgs>(this.graphVisualization_OnEntityRemoved); 71 71 this.graphVisualization.OnEntityAdded += new System.EventHandler<global::Netron.Diagramming.Core.EntityEventArgs>(this.graphVisualization_OnEntityAdded); 72 72 73 73 // 74 74 // GraphVisualizationInfoView -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/GraphVisualizationInfoView.cs
r6034 r6036 31 31 using Netron.Diagramming.Core; 32 32 33 namespace HeuristicLab.Operators.Views.GraphVisualization {33 namespace HeuristicLab.Operators.Views.GraphVisualization.Views { 34 34 [View("GraphVisualizationInfo View")] 35 35 [Content(typeof(IGraphVisualizationInfo), true)] -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.Designer.cs
r6034 r6036 20 20 #endregion 21 21 22 namespace HeuristicLab.Operators.Views.GraphVisualization {22 namespace HeuristicLab.Operators.Views.GraphVisualization.Views { 23 23 partial class OperatorGraphView { 24 24 /// <summary> … … 47 47 this.components = new System.ComponentModel.Container(); 48 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OperatorGraphView)); 49 this.graphVisualizationInfoView = new HeuristicLab.Operators.Views.GraphVisualization. GraphVisualizationInfoView();49 this.graphVisualizationInfoView = new HeuristicLab.Operators.Views.GraphVisualization.Views.GraphVisualizationInfoView(); 50 50 this.shapeContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); 51 51 this.openViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.cs
r6034 r6036 29 29 using Netron.Diagramming.Core; 30 30 31 namespace HeuristicLab.Operators.Views.GraphVisualization {31 namespace HeuristicLab.Operators.Views.GraphVisualization.Views { 32 32 [View("OperatorGraph View (Chart)")] 33 33 [Content(typeof(OperatorGraph), true)] -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorShape.cs
r6034 r6036 28 28 using Netron.Diagramming.Core; 29 29 30 31 namespace HeuristicLab.Operators.Views.GraphVisualization { 30 namespace HeuristicLab.Operators.Views.GraphVisualization.Views { 32 31 public class OperatorShape : ComplexShapeBase { 33 32 private static int LABEL_HEIGHT = 16; -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/General/IShapeInfo.cs
r5445 r6036 24 24 using System.Drawing; 25 25 using HeuristicLab.Common; 26 using Netron.Diagramming.Core;27 26 28 27 namespace HeuristicLab.Operators.Views.GraphVisualization { 29 28 public interface IShapeInfo : IDeepCloneable { 30 Type ShapeType { get; }31 29 Point Location { get; set; } 32 33 IShape CreateShape();34 30 IEnumerable<string> Connectors { get; } 35 void UpdateShape(IShape shape);36 void UpdateShapeInfo(IShape shape);37 31 38 32 event EventHandler Changed; -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/General/ShapeInfo.cs
r5445 r6036 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using Netron.Diagramming.Core;28 27 29 28 namespace HeuristicLab.Operators.Views.GraphVisualization { … … 34 33 protected ShapeInfo(ShapeInfo original, Cloner cloner) 35 34 : base(original, cloner) { 36 shapeType = original.shapeType;37 35 location = original.location; 38 36 } 39 37 40 protected ShapeInfo(Type shapeType) { 41 if (!typeof(IShape).IsAssignableFrom(shapeType)) 42 throw new ArgumentException("The passed shape type " + shapeType + " must be derived from IShape."); 43 this.shapeType = shapeType; 44 } 45 46 [Storable] 47 private Type shapeType; 48 public Type ShapeType { 49 get { return this.shapeType; } 50 } 38 protected ShapeInfo() : base() { } 51 39 52 40 [Storable] … … 69 57 if (handler != null) this.Changed(this, EventArgs.Empty); 70 58 } 71 72 public virtual IShape CreateShape() {73 IShape shape = (IShape)Activator.CreateInstance(this.shapeType);74 shape.Tag = this;75 shape.Location = this.Location;76 return shape;77 }78 79 public virtual void UpdateShape(IShape shape) {80 shape.Location = this.Location;81 }82 83 public virtual void UpdateShapeInfo(IShape shape) {84 this.Location = shape.Location;85 }86 59 } 87 60 } -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/HeuristicLab.Operators.Views.GraphVisualization-3.3.csproj
r5163 r6036 12 12 <AssemblyName>HeuristicLab.Operators.Views.GraphVisualization-3.3</AssemblyName> 13 13 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 14 <TargetFrameworkProfile></TargetFrameworkProfile> 14 <TargetFrameworkProfile> 15 </TargetFrameworkProfile> 15 16 <FileAlignment>512</FileAlignment> 16 17 <SignAssembly>true</SignAssembly> … … 112 113 <ItemGroup> 113 114 <Compile Include="HeuristicLabOperatorsViewsGraphVisualizationPlugin.cs" /> 115 <Compile Include="OperatorGraphVisualization\OperatorShape.cs" /> 116 <Compile Include="OperatorGraphVisualization\OperatorShapeInfoFactory.cs" /> 114 117 <Compile Include="Properties\AssemblyInfo.cs" /> 115 118 </ItemGroup> … … 119 122 <None Include="Properties\AssemblyInfo.frame" /> 120 123 <Compile Include="General\GraphVisualizationInfo.cs" /> 121 <Compile Include="General\GraphVisualizationInfoView.cs">122 <SubType>UserControl</SubType>123 </Compile>124 <Compile Include="General\GraphVisualizationInfoView.Designer.cs">125 <DependentUpon>GraphVisualizationInfoView.cs</DependentUpon>126 </Compile>127 124 <Compile Include="General\ConnectionInfo.cs" /> 128 125 <Compile Include="General\IConnectionInfo.cs" /> 129 126 <Compile Include="General\IGraphVisualizationInfo.cs" /> 130 127 <Compile Include="OperatorGraphVisualization\IOperatorShapeInfo.cs" /> 131 <Compile Include="OperatorGraphVisualization\OperatorGraphView.cs">132 <SubType>UserControl</SubType>133 </Compile>134 <Compile Include="OperatorGraphVisualization\OperatorGraphView.Designer.cs">135 <DependentUpon>OperatorGraphView.cs</DependentUpon>136 </Compile>137 128 <Compile Include="OperatorGraphVisualization\OperatorGraphVisualizationInfo.cs"> 138 129 <SubType>Code</SubType> … … 141 132 <Compile Include="BidirectionalLookup.cs" /> 142 133 <Compile Include="General\IShapeInfo.cs" /> 143 <Compile Include="OperatorGraphVisualization\OperatorShape.cs" />144 134 <Compile Include="General\ShapeInfo.cs"> 145 135 <SubType>Code</SubType> 146 136 </Compile> 147 <Compile Include="OperatorGraphVisualization\OperatorShapeInfoFactory.cs" />148 137 </ItemGroup> 149 138 <ItemGroup> … … 152 141 <Name>HeuristicLab.Collections-3.3</Name> 153 142 </ProjectReference> 154 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">155 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>156 <Name>HeuristicLab.Common.Resources-3.3</Name>157 </ProjectReference>158 143 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 159 144 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> 160 145 <Name>HeuristicLab.Common-3.3</Name> 161 </ProjectReference>162 <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">163 <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>164 <Name>HeuristicLab.Core.Views-3.3</Name>165 146 </ProjectReference> 166 147 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> … … 168 149 <Name>HeuristicLab.Core-3.3</Name> 169 150 </ProjectReference> 170 <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.Netron\3.0.2672.12446\HeuristicLab.Netron-3.0.2672.12446\HeuristicLab.Netron-3.0.2672.12446.csproj">171 <Project>{BB994448-2B21-4564-BB2E-38D8FFF8CF18}</Project>172 <Name>HeuristicLab.Netron-3.0.2672.12446 %28HeuristicLab.ExtLibs\HeuristicLab.Netron\HeuristicLab.Netron-3.0.2672.12446\HeuristicLab.Netron-3.0.2672.12446%29</Name>173 </ProjectReference>174 <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.Netron\3.0.2672.12446\Netron.Diagramming.Core-3.0.2672.12446\Netron.Diagramming.Core-3.0.2672.12446.csproj">175 <Project>{96AEBBEE-4203-45F3-BCF5-7B73BF256BDA}</Project>176 <Name>Netron.Diagramming.Core-3.0.2672.12446</Name>177 </ProjectReference>178 <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">179 <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>180 <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>181 </ProjectReference>182 <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">183 <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>184 <Name>HeuristicLab.MainForm-3.3</Name>185 </ProjectReference>186 <ProjectReference Include="..\..\HeuristicLab.Operators.Views\3.3\HeuristicLab.Operators.Views-3.3.csproj">187 <Project>{C49CB749-8B24-4628-8003-E86475749410}</Project>188 <Name>HeuristicLab.Operators.Views-3.3</Name>189 </ProjectReference>190 151 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 191 152 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 192 153 <Name>HeuristicLab.Operators-3.3</Name> 193 </ProjectReference>194 <ProjectReference Include="..\..\HeuristicLab.Optimizer\3.3\HeuristicLab.Optimizer-3.3.csproj">195 <Project>{C664305E-497C-4533-A140-967DEDB05C19}</Project>196 <Name>HeuristicLab.Optimizer-3.3</Name>197 </ProjectReference>198 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">199 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>200 <Name>HeuristicLab.Parameters-3.3</Name>201 154 </ProjectReference> 202 155 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/HeuristicLabOperatorsViewsGraphVisualizationPlugin.cs.frame
r5446 r6036 33 33 [PluginDependency("HeuristicLab.Collections", "3.3")] 34 34 [PluginDependency("HeuristicLab.Common", "3.3")] 35 [PluginDependency("HeuristicLab.Common.Resources", "3.3")]36 35 [PluginDependency("HeuristicLab.Core", "3.3")] 37 [PluginDependency("HeuristicLab.MainForm", "3.3")]38 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]39 [PluginDependency("HeuristicLab.Netron", "3.0")]40 36 [PluginDependency("HeuristicLab.Persistence", "3.3")] 41 37 public class HeuristicLabOperatorsViewsGraphVisualizationPlugin : PluginBase { -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/IOperatorShapeInfo.cs
r5445 r6036 35 35 void RemoveConnector(string connectorName); 36 36 37 IEnumerable<string> Labels { get; } 37 38 void UpdateLabels(IEnumerable<string> labels); 38 39 } -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorGraphVisualizationInfo.cs
r5445 r6036 128 128 } 129 129 130 internalIOperator GetOperatorForShapeInfo(IOperatorShapeInfo shapeInfo) {130 public IOperator GetOperatorForShapeInfo(IOperatorShapeInfo shapeInfo) { 131 131 return this.operatorShapeInfoMapping.GetBySecond(shapeInfo); 132 132 } … … 192 192 193 193 #region methods to manipulate operatorgraph by the shape info 194 internalvoid AddShapeInfo(IOperator op, IOperatorShapeInfo shapeInfo) {194 public void AddShapeInfo(IOperator op, IOperatorShapeInfo shapeInfo) { 195 195 this.RegisterOperatorEvents(op); 196 196 this.operatorParameterCollectionMapping.Add(op, op.Parameters); -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShape.cs
r5445 r6036 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Drawing;25 using System.Drawing.Drawing2D;26 using System.Linq;27 using HeuristicLab.Netron;28 using Netron.Diagramming.Core;29 22 30 23 31 24 namespace HeuristicLab.Operators.Views.GraphVisualization { 32 public class OperatorShape : ComplexShapeBase { 33 private static int LABEL_HEIGHT = 16; 34 private static int LABEL_WIDTH = 180; 35 private static int LABEL_SPACING = 3; 36 private int headerHeight = 30; 37 38 private ExpandableIconMaterial expandIconMaterial; 39 public OperatorShape() 40 : base() { 41 this.Resizable = false; 42 this.additionalConnectors = new List<IConnector>(); 43 this.labels = new List<string>(); 44 } 45 46 public override string EntityName { 47 get { return "Operator Shape"; } 48 } 49 50 public bool Collapsed { 51 get { return this.expandIconMaterial.Collapsed; } 52 set { 53 if (this.expandIconMaterial.Collapsed != value) 54 this.expandIconMaterial.Collapsed = value; 55 } 56 } 57 58 private Color lineColor; 59 public Color LineColor { 60 get { return this.lineColor; } 61 set { this.lineColor = value; } 62 } 63 64 private float lineWidth; 65 public float LineWidth { 66 get { return this.lineWidth; } 67 set { this.lineWidth = value; } 68 } 69 70 private Color color; 71 public Color Color { 72 get { return this.color; } 73 set { this.color = value; } 74 } 75 76 private string title; 77 public string Title { 78 get { return title; } 79 set { title = value; } 80 } 81 82 private IconMaterial iconMaterial; 83 public Bitmap Icon { 84 get { return this.iconMaterial.Icon; } 85 set { 86 this.iconMaterial.Icon = value; 87 this.iconMaterial.Transform(new Rectangle(new Point(Rectangle.X + 5, Rectangle.Y + 5), this.iconMaterial.Icon.Size)); 88 } 89 } 90 91 #region additional connectors 92 private List<IConnector> additionalConnectors; 93 public IEnumerable<string> AdditionalConnectorNames { 94 get { return this.additionalConnectors.Select(c => c.Name); } 95 } 96 97 private IConnector predecessor; 98 public IConnector Predecessor { 99 get { return this.predecessor; } 100 } 101 102 private IConnector successor; 103 public IConnector Successor { 104 get { return this.successor; } 105 } 106 107 private IConnector CreateConnector(string connectorName, Point location) { 108 Connector connector = new Connector(location, this.Model); 109 connector.ConnectorStyle = ConnectorStyle.Square; 110 connector.Parent = this; 111 connector.Name = connectorName; 112 return connector; 113 } 114 115 public void AddConnector(string connectorName) { 116 IConnector connector = this.CreateConnector(connectorName, this.BottomRightCorner); 117 118 this.additionalConnectors.Add(connector); 119 this.Connectors.Add(connector); 120 this.UpdateConnectorLocation(); 121 } 122 123 public void RemoveConnector(string connectorName) { 124 IConnector connector = this.additionalConnectors.Where(c => c.Name == connectorName).FirstOrDefault(); 125 if (connector != null) { 126 this.additionalConnectors.Remove(connector); 127 this.Connectors.Remove(connector); 128 this.UpdateConnectorLocation(); 129 } 130 } 131 132 private void UpdateConnectorLocation() { 133 if (this.additionalConnectors.Count == 0) 134 return; 135 136 int spacing = this.Rectangle.Width / this.additionalConnectors.Count; 137 int margin = spacing / 2; 138 int posX = margin + this.Rectangle.X; 139 for (int i = 0; i < this.additionalConnectors.Count; i++) { 140 this.additionalConnectors[i].MoveBy(new Point(posX - this.additionalConnectors[i].Point.X, 0)); 141 posX += spacing; 142 } 143 } 144 #endregion 145 146 #region label material 147 private List<string> labels; 148 public IEnumerable<string> Labels { 149 get { return this.labels; } 150 } 151 152 public void UpdateLabels(IEnumerable<string> labels) { 153 this.labels = new List<string>(labels); 154 this.expandIconMaterial.Visible = this.labels.Count != 0; 155 this.UpdateLabels(); 156 } 157 #endregion 158 159 private void expandIconMaterial_OnExpand(object sender, EventArgs e) { 160 this.UpdateLabels(); 161 } 162 163 private void expandIconMaterial_OnCollapse(object sender, EventArgs e) { 164 this.UpdateLabels(); 165 } 166 167 private Size CalculateSize() { 168 int width = this.Rectangle.Width; 169 int height = headerHeight; 170 if (!Collapsed) 171 height += this.labels.Count * (LABEL_HEIGHT + LABEL_SPACING); 172 return new Size(width, height); 173 } 174 175 private void UpdateLabels() { 176 Size newSize = CalculateSize(); 177 if (this.Rectangle.Size != newSize) { 178 foreach (IConnector connector in this.additionalConnectors) 179 connector.MoveBy(new Point(0, newSize.Height - this.Rectangle.Height)); 180 this.mRectangle = new Rectangle(this.Rectangle.Location, newSize); 181 this.Invalidate(); 182 this.RaiseOnChange(this, new EntityEventArgs(this)); 183 } 184 } 185 186 protected override void Initialize() { 187 base.Initialize(); 188 189 //the initial size 190 this.Transform(0, 0, 200, headerHeight); 191 this.color = Color.LightBlue; 192 193 this.iconMaterial = new IconMaterial(); 194 this.iconMaterial.Gliding = false; 195 this.Children.Add(iconMaterial); 196 197 Bitmap expandBitmap = new Bitmap(HeuristicLab.Common.Resources.VSImageLibrary.Expand); 198 Bitmap collapseBitmap = new Bitmap(HeuristicLab.Common.Resources.VSImageLibrary.Collapse); 199 this.expandIconMaterial = new ExpandableIconMaterial(expandBitmap, collapseBitmap); 200 this.expandIconMaterial.Gliding = false; 201 this.expandIconMaterial.Transform(new Rectangle(new Point(Rectangle.Right - 20, Rectangle.Y + 7), expandIconMaterial.Icon.Size)); 202 this.expandIconMaterial.Visible = false; 203 this.expandIconMaterial.OnExpand += new EventHandler(expandIconMaterial_OnExpand); 204 this.expandIconMaterial.OnCollapse += new EventHandler(expandIconMaterial_OnCollapse); 205 this.Children.Add(expandIconMaterial); 206 207 this.predecessor = this.CreateConnector(OperatorShapeInfoFactory.PredecessorConnector, new Point(Rectangle.Left, Center.Y)); 208 this.Connectors.Add(predecessor); 209 210 this.successor = this.CreateConnector(OperatorShapeInfoFactory.SuccessorConnector, (new Point(Rectangle.Right, Center.Y))); 211 this.Connectors.Add(successor); 212 } 213 214 public override void Paint(Graphics g) { 215 base.Paint(g); 216 217 g.SmoothingMode = SmoothingMode.HighQuality; 218 219 Pen pen = new Pen(lineColor, lineWidth); 220 221 SizeF titleSize = g.MeasureString(this.Title, ArtPalette.DefaultBoldFont, Rectangle.Width - 45); 222 if (titleSize.Height + 10 > Rectangle.Height) { 223 headerHeight = (int)titleSize.Height + 10; 224 this.UpdateLabels(); 225 } 226 227 GraphicsPath path = new GraphicsPath(); 228 path.AddArc(Rectangle.X, Rectangle.Y, 20, 20, -180, 90); 229 path.AddLine(Rectangle.X + 10, Rectangle.Y, Rectangle.X + Rectangle.Width - 10, Rectangle.Y); 230 path.AddArc(Rectangle.X + Rectangle.Width - 20, Rectangle.Y, 20, 20, -90, 90); 231 path.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y + 10, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height - 10); 232 path.AddArc(Rectangle.X + Rectangle.Width - 20, Rectangle.Y + Rectangle.Height - 20, 20, 20, 0, 90); 233 path.AddLine(Rectangle.X + Rectangle.Width - 10, Rectangle.Y + Rectangle.Height, Rectangle.X + 10, Rectangle.Y + Rectangle.Height); 234 path.AddArc(Rectangle.X, Rectangle.Y + Rectangle.Height - 20, 20, 20, 90, 90); 235 path.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height - 10, Rectangle.X, Rectangle.Y + 10); 236 //shadow 237 if (ArtPalette.EnableShadows) { 238 Region darkRegion = new Region(path); 239 darkRegion.Translate(5, 5); 240 g.FillRegion(ArtPalette.ShadowBrush, darkRegion); 241 } 242 //background 243 g.FillPath(Brush, path); 244 245 using (LinearGradientBrush gradientBrush = new LinearGradientBrush(Rectangle.Location, new Point(Rectangle.X + Rectangle.Width, Rectangle.Y), this.Color, Color.White)) { 246 Region gradientRegion = new Region(path); 247 g.FillRegion(gradientBrush, gradientRegion); 248 } 249 250 if (!this.Collapsed) { 251 TextStyle textStyle = new TextStyle(Color.Black, new Font("Arial", 7), StringAlignment.Near, StringAlignment.Near); 252 StringFormat stringFormat = textStyle.StringFormat; 253 stringFormat.Trimming = StringTrimming.EllipsisWord; 254 stringFormat.FormatFlags = StringFormatFlags.LineLimit; 255 Rectangle rect; 256 257 for (int i = 0; i < this.labels.Count; i++) { 258 rect = new Rectangle(Rectangle.X + 25, Rectangle.Y + headerHeight + i * (LABEL_HEIGHT + LABEL_SPACING), LABEL_WIDTH, LABEL_HEIGHT); 259 g.DrawString(textStyle.GetFormattedText(this.labels[i]), textStyle.Font, textStyle.GetBrush(), rect, stringFormat); 260 } 261 } 262 263 //the border 264 g.DrawPath(pen, path); 265 266 //the title 267 g.DrawString(this.Title, ArtPalette.DefaultBoldFont, Brushes.Black, new Rectangle(Rectangle.X + 25, Rectangle.Y + 5, Rectangle.Width - 45, Rectangle.Height - 5)); 268 269 270 //the material 271 foreach (IPaintable material in Children) 272 material.Paint(g); 273 274 //the connectors 275 if (this.ShowConnectors) { 276 for (int k = 0; k < Connectors.Count; k++) 277 Connectors[k].Paint(g); 278 } 279 } 25 internal class OperatorShape { 26 //21.04.2011 mkommend 27 //Do not delete this empty class, because this type was moved in to the plugin GraphVisualiation.Views 28 //But it is referenced in persisted ShapeInfo objects and thus these files could not be loaded without this type 29 //Should be removed with HL 3.4 280 30 } 281 31 } -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShapeInfo.cs
r6031 r6036 22 22 using System.Collections.Generic; 23 23 using System.Drawing; 24 using System.Linq;25 24 using HeuristicLab.Common; 26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using Netron.Diagramming.Core;28 26 29 27 namespace HeuristicLab.Operators.Views.GraphVisualization { 30 28 [StorableClass] 31 internalclass OperatorShapeInfo : ShapeInfo, IOperatorShapeInfo {29 public class OperatorShapeInfo : ShapeInfo, IOperatorShapeInfo { 32 30 [Storable] 33 31 private List<string> labels; 32 public IEnumerable<string> Labels { 33 get { return labels; } 34 } 34 35 35 36 private object lockObject = new object(); … … 61 62 62 63 public OperatorShapeInfo() 63 : base( typeof(OperatorShape)) {64 : base() { 64 65 this.connectorNames = new List<string>(); 65 66 this.labels = new List<string>(); … … 173 174 } 174 175 } 175 176 public override IShape CreateShape() {177 OperatorShape shape = (OperatorShape)base.CreateShape();178 shape.Title = this.Title;179 shape.Color = this.Color;180 shape.LineColor = this.LineColor;181 shape.LineWidth = this.LineWidth;182 shape.Icon = this.Icon;183 shape.Collapsed = this.Collapsed;184 foreach (string connectorName in this.connectorNames)185 if (connectorName != OperatorShapeInfoFactory.SuccessorConnector && connectorName != OperatorShapeInfoFactory.PredecessorConnector)186 shape.AddConnector(connectorName);187 188 shape.UpdateLabels(this.labels);189 return shape;190 }191 192 public override void UpdateShape(IShape shape) {193 base.UpdateShape(shape);194 OperatorShape operatorShape = (OperatorShape)shape;195 operatorShape.Title = this.Title;196 operatorShape.Color = this.Color;197 operatorShape.LineColor = this.LineColor;198 operatorShape.LineWidth = this.LineWidth;199 operatorShape.Icon = this.Icon;200 operatorShape.Collapsed = this.Collapsed;201 202 int i = 0;203 int j = 0;204 //remove old connectors and skip correct connectors205 List<string> oldConnectorNames = operatorShape.AdditionalConnectorNames.ToList();206 while (i < this.connectorNames.Count && j < oldConnectorNames.Count) {207 if (connectorNames[i] == OperatorShapeInfoFactory.SuccessorConnector ||208 connectorNames[i] == OperatorShapeInfoFactory.PredecessorConnector)209 i++;210 else if (oldConnectorNames[j] == OperatorShapeInfoFactory.SuccessorConnector ||211 oldConnectorNames[j] == OperatorShapeInfoFactory.PredecessorConnector)212 j++;213 else if (this.connectorNames[i] != oldConnectorNames[j]) {214 operatorShape.RemoveConnector(oldConnectorNames[j]);215 j++;216 } else {217 i++;218 j++;219 }220 }221 //remove remaining old connectors222 for (; j < oldConnectorNames.Count; j++)223 operatorShape.RemoveConnector(oldConnectorNames[j]);224 225 //add new connectors except successor and connector226 for (; i < this.connectorNames.Count; i++)227 if (this.connectorNames[i] != OperatorShapeInfoFactory.SuccessorConnector && this.connectorNames[i] != OperatorShapeInfoFactory.PredecessorConnector)228 operatorShape.AddConnector(this.connectorNames[i]);229 230 operatorShape.UpdateLabels(this.labels);231 }232 233 public override void UpdateShapeInfo(IShape shape) {234 base.UpdateShapeInfo(shape);235 OperatorShape operatorShape = (OperatorShape)shape;236 this.Title = operatorShape.Title;237 this.Color = operatorShape.Color;238 this.LineColor = operatorShape.LineColor;239 this.LineWidth = operatorShape.LineWidth;240 this.Icon = operatorShape.Icon;241 this.Collapsed = operatorShape.Collapsed;242 }243 176 } 244 177 } -
trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShapeInfoFactory.cs
r5445 r6036 26 26 27 27 namespace HeuristicLab.Operators.Views.GraphVisualization { 28 internalstatic class OperatorShapeInfoFactory {28 public static class OperatorShapeInfoFactory { 29 29 public const string PredecessorConnector = "Predecessor"; 30 30 public const string SuccessorConnector = "Successor"; -
trunk/sources/HeuristicLab/3.3/Files.txt
r5933 r6036 43 43 HeuristicLab.Operators.Views\3.3:HeuristicLab.Operators.Views-3.3.dll 44 44 HeuristicLab.Operators.Views.GraphVisualization\3.3:HeuristicLab.Operators.Views.GraphVisualization-3.3.dll 45 HeuristicLab.Operators.Views.GraphVisualization.Views\3.3:HeuristicLab.Operators.Views.GraphVisualization.Views-3.3.dll 45 46 HeuristicLab.Operators.Programmable\3.3:HeuristicLab.Operators.Programmable-3.3.dll 46 47 HeuristicLab.Optimization\3.3:HeuristicLab.Optimization-3.3.dll -
trunk/sources/HeuristicLab/3.3/Tests/Builder.testsettings
r5888 r6036 46 46 <DeploymentItem filename="HeuristicLab\3.3\Tests\bin\Release\HeuristicLab.Netron-3.0.2672.12446.dll" /> 47 47 <DeploymentItem filename="HeuristicLab\3.3\Tests\bin\Release\HeuristicLab.Operators.Programmable-3.3.dll" /> 48 <DeploymentItem filename="HeuristicLab\3.3\Tests\bin\Release\HeuristicLab.Operators.Views.GraphVisualization.Views-3.3.dll" /> 48 49 <DeploymentItem filename="HeuristicLab\3.3\Tests\bin\Release\HeuristicLab.Operators.Views.GraphVisualization-3.3.dll" /> 49 50 <DeploymentItem filename="HeuristicLab\3.3\Tests\bin\Release\HeuristicLab.Operators.Views-3.3.dll" /> -
trunk/sources/HeuristicLab/3.3/Tests/HeuristicLab-3.3.Tests.csproj
r5938 r6036 332 332 <Name>HeuristicLab.Operators.Programmable-3.3</Name> 333 333 </ProjectReference> 334 <ProjectReference Include="..\..\..\HeuristicLab.Operators.Views.GraphVisualization.Views\3.3\HeuristicLab.Operators.Views.GraphVisualization.Views-3.3.csproj"> 335 <Project>{0C39A349-1979-419A-89BD-E4E2F26BD287}</Project> 336 <Name>HeuristicLab.Operators.Views.GraphVisualization.Views-3.3</Name> 337 </ProjectReference> 334 338 <ProjectReference Include="..\..\..\HeuristicLab.Operators.Views.GraphVisualization\3.3\HeuristicLab.Operators.Views.GraphVisualization-3.3.csproj"> 335 339 <Project>{57F38579-409D-4DD8-AB19-3F2C4A665126}</Project>
Note: See TracChangeset
for help on using the changeset viewer.