Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6036


Ignore:
Timestamp:
04/21/11 17:16:50 (14 years ago)
Author:
mkommend
Message:

#1486: Decoupled operator graph visualization content classes from view classes.

Location:
trunk/sources
Files:
8 added
13 edited
5 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab 3.3.sln

    r5944 r6036  
    394394EndProject
    395395Project("{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}"
     396EndProject
     397Project("{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}"
    396398EndProject
    397399Global
     
    18361838    {F5013F6B-5A2D-4741-8FC9-31A6968E9C41}.Release|x86.ActiveCfg = Release|x86
    18371839    {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
    18381852  EndGlobalSection
    18391853  GlobalSection(SolutionProperties) = preSolution
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/GraphVisualizationInfoView.Designer.cs

    r6034 r6036  
    2020#endregion
    2121
    22 namespace HeuristicLab.Operators.Views.GraphVisualization {
     22namespace HeuristicLab.Operators.Views.GraphVisualization.Views {
    2323  partial class GraphVisualizationInfoView {
    2424    /// <summary>
     
    7070      this.graphVisualization.OnEntityRemoved += new System.EventHandler<global::Netron.Diagramming.Core.EntityEventArgs>(this.graphVisualization_OnEntityRemoved);
    7171      this.graphVisualization.OnEntityAdded += new System.EventHandler<global::Netron.Diagramming.Core.EntityEventArgs>(this.graphVisualization_OnEntityAdded);
    72      
     72
    7373      //
    7474      // GraphVisualizationInfoView
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/GraphVisualizationInfoView.cs

    r6034 r6036  
    3131using Netron.Diagramming.Core;
    3232
    33 namespace HeuristicLab.Operators.Views.GraphVisualization {
     33namespace HeuristicLab.Operators.Views.GraphVisualization.Views {
    3434  [View("GraphVisualizationInfo View")]
    3535  [Content(typeof(IGraphVisualizationInfo), true)]
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.Designer.cs

    r6034 r6036  
    2020#endregion
    2121
    22 namespace HeuristicLab.Operators.Views.GraphVisualization {
     22namespace HeuristicLab.Operators.Views.GraphVisualization.Views {
    2323  partial class OperatorGraphView {
    2424    /// <summary>
     
    4747      this.components = new System.ComponentModel.Container();
    4848      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();
    5050      this.shapeContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
    5151      this.openViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorGraphView.cs

    r6034 r6036  
    2929using Netron.Diagramming.Core;
    3030
    31 namespace HeuristicLab.Operators.Views.GraphVisualization {
     31namespace HeuristicLab.Operators.Views.GraphVisualization.Views {
    3232  [View("OperatorGraph View (Chart)")]
    3333  [Content(typeof(OperatorGraph), true)]
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization.Views/3.3/OperatorShape.cs

    r6034 r6036  
    2828using Netron.Diagramming.Core;
    2929
    30 
    31 namespace HeuristicLab.Operators.Views.GraphVisualization {
     30namespace HeuristicLab.Operators.Views.GraphVisualization.Views {
    3231  public class OperatorShape : ComplexShapeBase {
    3332    private static int LABEL_HEIGHT = 16;
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/General/IShapeInfo.cs

    r5445 r6036  
    2424using System.Drawing;
    2525using HeuristicLab.Common;
    26 using Netron.Diagramming.Core;
    2726
    2827namespace HeuristicLab.Operators.Views.GraphVisualization {
    2928  public interface IShapeInfo : IDeepCloneable {
    30     Type ShapeType { get; }
    3129    Point Location { get; set; }
    32 
    33     IShape CreateShape();
    3430    IEnumerable<string> Connectors { get; }
    35     void UpdateShape(IShape shape);
    36     void UpdateShapeInfo(IShape shape);
    3731
    3832    event EventHandler Changed;
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/General/ShapeInfo.cs

    r5445 r6036  
    2525using HeuristicLab.Common;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    27 using Netron.Diagramming.Core;
    2827
    2928namespace HeuristicLab.Operators.Views.GraphVisualization {
     
    3433    protected ShapeInfo(ShapeInfo original, Cloner cloner)
    3534      : base(original, cloner) {
    36       shapeType = original.shapeType;
    3735      location = original.location;
    3836    }
    3937
    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() { }
    5139
    5240    [Storable]
     
    6957      if (handler != null) this.Changed(this, EventArgs.Empty);
    7058    }
    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     }
    8659  }
    8760}
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/HeuristicLab.Operators.Views.GraphVisualization-3.3.csproj

    r5163 r6036  
    1212    <AssemblyName>HeuristicLab.Operators.Views.GraphVisualization-3.3</AssemblyName>
    1313    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    14     <TargetFrameworkProfile></TargetFrameworkProfile>
     14    <TargetFrameworkProfile>
     15    </TargetFrameworkProfile>
    1516    <FileAlignment>512</FileAlignment>
    1617    <SignAssembly>true</SignAssembly>
     
    112113  <ItemGroup>
    113114    <Compile Include="HeuristicLabOperatorsViewsGraphVisualizationPlugin.cs" />
     115    <Compile Include="OperatorGraphVisualization\OperatorShape.cs" />
     116    <Compile Include="OperatorGraphVisualization\OperatorShapeInfoFactory.cs" />
    114117    <Compile Include="Properties\AssemblyInfo.cs" />
    115118  </ItemGroup>
     
    119122    <None Include="Properties\AssemblyInfo.frame" />
    120123    <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>
    127124    <Compile Include="General\ConnectionInfo.cs" />
    128125    <Compile Include="General\IConnectionInfo.cs" />
    129126    <Compile Include="General\IGraphVisualizationInfo.cs" />
    130127    <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>
    137128    <Compile Include="OperatorGraphVisualization\OperatorGraphVisualizationInfo.cs">
    138129      <SubType>Code</SubType>
     
    141132    <Compile Include="BidirectionalLookup.cs" />
    142133    <Compile Include="General\IShapeInfo.cs" />
    143     <Compile Include="OperatorGraphVisualization\OperatorShape.cs" />
    144134    <Compile Include="General\ShapeInfo.cs">
    145135      <SubType>Code</SubType>
    146136    </Compile>
    147     <Compile Include="OperatorGraphVisualization\OperatorShapeInfoFactory.cs" />
    148137  </ItemGroup>
    149138  <ItemGroup>
     
    152141      <Name>HeuristicLab.Collections-3.3</Name>
    153142    </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>
    158143    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    159144      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
    160145      <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>
    165146    </ProjectReference>
    166147    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
     
    168149      <Name>HeuristicLab.Core-3.3</Name>
    169150    </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>
    190151    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    191152      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
    192153      <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>
    201154    </ProjectReference>
    202155    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/HeuristicLabOperatorsViewsGraphVisualizationPlugin.cs.frame

    r5446 r6036  
    3333  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3434  [PluginDependency("HeuristicLab.Common", "3.3")]
    35   [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
    3635  [PluginDependency("HeuristicLab.Core", "3.3")]
    37   [PluginDependency("HeuristicLab.MainForm", "3.3")]
    38   [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    39   [PluginDependency("HeuristicLab.Netron", "3.0")]
    4036  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    4137  public class HeuristicLabOperatorsViewsGraphVisualizationPlugin : PluginBase {
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/IOperatorShapeInfo.cs

    r5445 r6036  
    3535    void RemoveConnector(string connectorName);
    3636
     37    IEnumerable<string> Labels { get; }
    3738    void UpdateLabels(IEnumerable<string> labels);
    3839  }
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorGraphVisualizationInfo.cs

    r5445 r6036  
    128128    }
    129129
    130     internal IOperator GetOperatorForShapeInfo(IOperatorShapeInfo shapeInfo) {
     130    public IOperator GetOperatorForShapeInfo(IOperatorShapeInfo shapeInfo) {
    131131      return this.operatorShapeInfoMapping.GetBySecond(shapeInfo);
    132132    }
     
    192192
    193193    #region methods to manipulate operatorgraph by the shape info
    194     internal void AddShapeInfo(IOperator op, IOperatorShapeInfo shapeInfo) {
     194    public void AddShapeInfo(IOperator op, IOperatorShapeInfo shapeInfo) {
    195195      this.RegisterOperatorEvents(op);
    196196      this.operatorParameterCollectionMapping.Add(op, op.Parameters);
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShape.cs

    r5445 r6036  
    2020#endregion
    2121
    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;
    2922
    3023
    3124namespace 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
    28030  }
    28131}
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShapeInfo.cs

    r6031 r6036  
    2222using System.Collections.Generic;
    2323using System.Drawing;
    24 using System.Linq;
    2524using HeuristicLab.Common;
    2625using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    27 using Netron.Diagramming.Core;
    2826
    2927namespace HeuristicLab.Operators.Views.GraphVisualization {
    3028  [StorableClass]
    31   internal class OperatorShapeInfo : ShapeInfo, IOperatorShapeInfo {
     29  public class OperatorShapeInfo : ShapeInfo, IOperatorShapeInfo {
    3230    [Storable]
    3331    private List<string> labels;
     32    public IEnumerable<string> Labels {
     33      get { return labels; }
     34    }
    3435
    3536    private object lockObject = new object();
     
    6162
    6263    public OperatorShapeInfo()
    63       : base(typeof(OperatorShape)) {
     64      : base() {
    6465      this.connectorNames = new List<string>();
    6566      this.labels = new List<string>();
     
    173174      }
    174175    }
    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 connectors
    205       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 connectors
    222       for (; j < oldConnectorNames.Count; j++)
    223         operatorShape.RemoveConnector(oldConnectorNames[j]);
    224 
    225       //add new connectors except successor and connector
    226       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     }
    243176  }
    244177}
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShapeInfoFactory.cs

    r5445 r6036  
    2626
    2727namespace HeuristicLab.Operators.Views.GraphVisualization {
    28   internal static class OperatorShapeInfoFactory {
     28  public static class OperatorShapeInfoFactory {
    2929    public const string PredecessorConnector = "Predecessor";
    3030    public const string SuccessorConnector = "Successor";
  • trunk/sources/HeuristicLab/3.3/Files.txt

    r5933 r6036  
    4343HeuristicLab.Operators.Views\3.3:HeuristicLab.Operators.Views-3.3.dll
    4444HeuristicLab.Operators.Views.GraphVisualization\3.3:HeuristicLab.Operators.Views.GraphVisualization-3.3.dll
     45HeuristicLab.Operators.Views.GraphVisualization.Views\3.3:HeuristicLab.Operators.Views.GraphVisualization.Views-3.3.dll
    4546HeuristicLab.Operators.Programmable\3.3:HeuristicLab.Operators.Programmable-3.3.dll
    4647HeuristicLab.Optimization\3.3:HeuristicLab.Optimization-3.3.dll
  • trunk/sources/HeuristicLab/3.3/Tests/Builder.testsettings

    r5888 r6036  
    4646    <DeploymentItem filename="HeuristicLab\3.3\Tests\bin\Release\HeuristicLab.Netron-3.0.2672.12446.dll" />
    4747    <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" />
    4849    <DeploymentItem filename="HeuristicLab\3.3\Tests\bin\Release\HeuristicLab.Operators.Views.GraphVisualization-3.3.dll" />
    4950    <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  
    332332      <Name>HeuristicLab.Operators.Programmable-3.3</Name>
    333333    </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>
    334338    <ProjectReference Include="..\..\..\HeuristicLab.Operators.Views.GraphVisualization\3.3\HeuristicLab.Operators.Views.GraphVisualization-3.3.csproj">
    335339      <Project>{57F38579-409D-4DD8-AB19-3F2C4A665126}</Project>
Note: See TracChangeset for help on using the changeset viewer.