Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2875


Ignore:
Timestamp:
02/26/10 16:31:47 (14 years ago)
Author:
mkommend
Message:

corrected layouting issues in netron (ticket #867)

Location:
trunk/sources
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj

    r2845 r2875  
    5151    <ErrorReport>prompt</ErrorReport>
    5252  </PropertyGroup>
     53  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     54    <DebugSymbols>true</DebugSymbols>
     55    <OutputPath>bin\x86\Debug\</OutputPath>
     56    <DefineConstants>DEBUG;TRACE</DefineConstants>
     57    <DebugType>full</DebugType>
     58    <PlatformTarget>x86</PlatformTarget>
     59    <ErrorReport>prompt</ErrorReport>
     60  </PropertyGroup>
     61  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     62    <OutputPath>bin\x86\Release\</OutputPath>
     63    <DefineConstants>TRACE</DefineConstants>
     64    <DocumentationFile>bin\Release\HeuristicLab.Core.Views-3.3.XML</DocumentationFile>
     65    <Optimize>true</Optimize>
     66    <DebugType>pdbonly</DebugType>
     67    <PlatformTarget>x86</PlatformTarget>
     68    <ErrorReport>prompt</ErrorReport>
     69  </PropertyGroup>
    5370  <ItemGroup>
    5471    <Reference Include="System" />
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r2870 r2875  
    4343      InitializeComponent();
    4444      Caption = "Item Collection";
     45      this.Resize += new EventHandler(ItemCollectionView_Resize);
     46      this.splitContainer.Resize += new EventHandler(splitContainer_Resize);
     47      this.splitContainer.Panel1.Resize += new EventHandler(Panel1_Resize);
     48      this.splitContainer.Panel2.Resize += new EventHandler(Panel2_Resize);
     49
     50      this.detailsGroupBox.Resize += new EventHandler(detailsGroupBox_Resize);
     51      this.itemsGroupBox.Resize += new EventHandler(itemsGroupBox_Resize);
     52      this.itemsListView.Resize += new EventHandler(itemsListView_Resize);
     53    }
     54
     55    void Panel1_Resize(object sender, EventArgs e) {
     56     // MessageBox.Show("split.panel1 resized");
     57    }
     58
     59    void Panel2_Resize(object sender, EventArgs e) {
     60     // MessageBox.Show("split.panel2 resized");
     61    }
     62
     63    void itemsListView_Resize(object sender, EventArgs e) {
     64      //MessageBox.Show("itemslistview resized");
     65    }
     66
     67    void itemsGroupBox_Resize(object sender, EventArgs e) {
     68     // MessageBox.Show("items groupbox resized");
     69    }
     70
     71    void detailsGroupBox_Resize(object sender, EventArgs e) {
     72   //   MessageBox.Show("details groupbox resized");
     73    }
     74
     75    void splitContainer_Resize(object sender, EventArgs e) {
     76      //MessageBox.Show("split container resized");
     77     
     78    }
     79
     80    void ItemCollectionView_Resize(object sender, EventArgs e) {
     81   //   MessageBox.Show("control resized");
     82      this.splitContainer.SplitterDistance = this.splitContainer.SplitterDistance + 1;
    4583    }
    4684    public ItemCollectionView(IObservableCollection<T> content)
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Analysis/Model.Analysis.cs

    r2819 r2875  
    66using System.Text;
    77using Netron.Diagramming.Core.Analysis;
    8 namespace Netron.Diagramming.Core
    9 {
    10     public partial class Model : IGraph, ITree
    11     {
    12         #region Fields
    13         private bool mIsDirected;
    14         private ITree mSpanningTree;
    15         #endregion
    16 
    17         /// <summary>
    18         /// Get the in-degree of a node, the number of edges for which the node
    19         /// is the target.
    20         /// </summary>
    21         /// <param name="node"></param>
    22         /// <returns></returns>
    23         int IGraph.InDegree(INode node)
    24         {
    25             return (node as INode).InDegree;
     8namespace Netron.Diagramming.Core {
     9  public partial class Model : IGraph, ITree {
     10    #region Fields
     11    private bool mIsDirected;
     12    private ITree mSpanningTree;
     13    #endregion
     14
     15    /// <summary>
     16    /// Get the in-degree of a node, the number of edges for which the node
     17    /// is the target.
     18    /// </summary>
     19    /// <param name="node"></param>
     20    /// <returns></returns>
     21    int IGraph.InDegree(INode node) {
     22      return (node as INode).InDegree;
     23    }
     24
     25    /// <summary>
     26    /// Get the out-degree of a node, the number of edges for which the node
     27    /// is the source.
     28    /// </summary>
     29    /// <param name="node"></param>
     30    /// <returns></returns>
     31    int IGraph.OutDegree(INode node) {
     32      return (node as INode).OutDegree;
     33    }
     34
     35    /// <summary>
     36    /// Get the degree of a node, the number of edges for which a node
     37    /// is either the source or the target.
     38    /// </summary>
     39    /// <param name="node"></param>
     40    /// <returns></returns>
     41    int IGraph.Degree(INode node) {
     42      return (node as INode).Degree;
     43    }
     44
     45    /// <summary>
     46    /// Indicates if the edges of this graph are directed or undirected.
     47    /// </summary>
     48    /// <value></value>
     49    bool IGraph.IsDirected {
     50      get { return mIsDirected; }
     51    }
     52
     53    /// <summary>
     54    /// Returns the nodes for the current page. This is the same as the <see cref="Model.Shapes"/> property except that the return type is
     55    /// here <see cref="INode"/> rather than <see cref="IShape"/> type.
     56    /// </summary>
     57    /// <value></value>
     58    CollectionBase<INode> IGraph.Nodes {
     59      get {
     60        CollectionBase<INode> nodes = new CollectionBase<INode>();
     61        foreach (IShape shape in this.CurrentPage.Shapes) {
     62          nodes.Add(shape as INode);
    2663        }
    27 
    28         /// <summary>
    29         /// Get the out-degree of a node, the number of edges for which the node
    30         /// is the source.
    31         /// </summary>
    32         /// <param name="node"></param>
    33         /// <returns></returns>
    34         int IGraph.OutDegree(INode node)
    35         {
    36             return (node as INode).OutDegree;
     64        return nodes;
     65      }
     66    }
     67
     68    /// <summary>
     69    /// Gets the edges.
     70    /// </summary>
     71    /// <value>The edges.</value>
     72    CollectionBase<IEdge> IGraph.Edges {
     73      get {
     74        CollectionBase<IEdge> edges = new CollectionBase<IEdge>();
     75        foreach (IConnection cn in this.CurrentPage.Connections) {
     76          edges.Add(cn as IEdge);
    3777        }
    38 
    39         /// <summary>
    40         /// Get the degree of a node, the number of edges for which a node
    41         /// is either the source or the target.
    42         /// </summary>
    43         /// <param name="node"></param>
    44         /// <returns></returns>
    45         int IGraph.Degree(INode node)
    46         {
    47             return (node as INode).Degree;
     78        return edges;
     79      }
     80    }
     81    /// <summary>
     82    /// Get the source Node for the given Edge instance.
     83    /// </summary>
     84    /// <param name="edge"></param>
     85    /// <returns></returns>
     86    INode IGraph.FromNode(IEdge edge) {
     87      return edge.SourceNode;
     88    }
     89
     90    INode IGraph.ToNode(IEdge edge) {
     91      return edge.TargetNode;
     92    }
     93
     94    /// <summary>
     95    /// Given an Edge and an incident Node, return the other Node
     96    /// connected to the edge.
     97    /// </summary>
     98    /// <param name="edge"></param>
     99    /// <param name="node"></param>
     100    /// <returns></returns>
     101    INode IGraph.AdjacentNode(IEdge edge, INode node) {
     102      if (edge.SourceNode == node)
     103        return edge.TargetNode;
     104      else if (edge.TargetNode == node)
     105        return edge.SourceNode;
     106      else
     107        throw new InconsistencyException("The node is not a target or source node of the given edge.");
     108
     109    }
     110
     111    /// <summary>
     112    /// Gets the collection of all adjacent nodes connected to the given node by an
     113    /// incoming edge (i.e., all nodes that "point" at this one).
     114    /// </summary>
     115    /// <param name="node"></param>
     116    /// <returns></returns>
     117    CollectionBase<INode> IGraph.InNeighbors(INode node) {
     118      return node.InNeighbors;
     119    }
     120
     121    /// <summary>
     122    /// Gets the collection of adjacent nodes connected to the given node by an
     123    /// outgoing edge (i.e., all nodes "pointed" to by this one).
     124    /// </summary>
     125    /// <param name="node"></param>
     126    /// <returns></returns>
     127    CollectionBase<INode> IGraph.OutNeighbors(INode node) {
     128      return node.OutNeighbors;
     129    }
     130
     131    /// <summary>
     132    /// Get an iterator over all nodes connected to the given node.
     133    /// </summary>
     134    /// <param name="node"></param>
     135    /// <returns></returns>
     136    CollectionBase<INode> IGraph.Neighbors(INode node) {
     137      return node.Neighbors;
     138    }
     139
     140    /// <summary>
     141    /// Edgeses the specified node.
     142    /// </summary>
     143    /// <param name="node">The node.</param>
     144    /// <returns></returns>
     145    CollectionBase<IEdge> IGraph.EdgesOf(INode node) {
     146      return node.Edges;
     147    }
     148
     149    /// <summary>
     150    /// Ins the edges.
     151    /// </summary>
     152    /// <param name="node">The node.</param>
     153    /// <returns></returns>
     154    CollectionBase<IEdge> IGraph.InEdges(INode node) {
     155      return node.InEdges;
     156    }
     157
     158    /// <summary>
     159    /// Outs the edges.
     160    /// </summary>
     161    /// <param name="node">The node.</param>
     162    /// <returns></returns>
     163    CollectionBase<IEdge> IGraph.OutEdges(INode node) {
     164      return node.OutEdges;
     165    }
     166
     167
     168    /// <summary>
     169    /// Gets the spanning tree.
     170    /// </summary>
     171    /// <value>The spanning tree.</value>
     172    ITree IGraph.SpanningTree {
     173      get { return mSpanningTree; }
     174    }
     175
     176    /// <summary>
     177    /// Makes the spanning tree.
     178    /// </summary>
     179    /// <param name="node">The node.</param>
     180    /// <returns></returns>
     181    void IGraph.MakeSpanningTree(INode node) {
     182      // build unweighted spanning tree by BFS
     183      LinkedList<INode> q = new LinkedList<INode>();
     184      BitArray visit = new BitArray(this.CurrentPage.Shapes.Count);
     185      q.AddFirst(node);
     186      visit[this.CurrentPage.Shapes.IndexOf(node as IShape)] = true;
     187      INode n;
     188      while (q.Count > 0) {
     189        INode p = q.First.Value;
     190        q.RemoveFirst();
     191        if (p.Children == null)
     192          p.Children = new CollectionBase<INode>();
     193        if (visit[this.CurrentPage.Shapes.IndexOf(p as IShape)])
     194          p.Children.Clear();
     195        foreach (IEdge edge in p.Edges) {
     196          n = edge.AdjacentNode(p);
     197          if (n == null) continue;
     198          try {
     199            if (!visit[this.CurrentPage.Shapes.IndexOf(n as IShape)]) {
     200              q.AddLast(n);
     201              visit[this.CurrentPage.Shapes.IndexOf(n as IShape)] = true;
     202              n.ParentNode = p;
     203              n.ParentEdge = edge;
     204              p.Children.Add(n);
     205            }
     206          }
     207          catch (ArgumentOutOfRangeException) { continue; }
    48208        }
    49209
    50         /// <summary>
    51         /// Indicates if the edges of this graph are directed or undirected.
    52         /// </summary>
    53         /// <value></value>
    54         bool IGraph.IsDirected
    55         {
    56             get { return mIsDirected; }
    57         }
    58 
    59         /// <summary>
    60         /// Returns the nodes for the current page. This is the same as the <see cref="Model.Shapes"/> property except that the return type is
    61         /// here <see cref="INode"/> rather than <see cref="IShape"/> type.
    62         /// </summary>
    63         /// <value></value>
    64         CollectionBase<INode> IGraph.Nodes
    65         {
    66             get {
    67                 CollectionBase<INode> nodes = new CollectionBase<INode>();
    68                 foreach (IShape shape in this.CurrentPage.Shapes)
    69                 {
    70                     nodes.Add(shape as INode);
    71                 }
    72                 return nodes;
    73             }
    74         }
    75 
    76         /// <summary>
    77         /// Gets the edges.
    78         /// </summary>
    79         /// <value>The edges.</value>
    80         CollectionBase<IEdge> IGraph.Edges
    81         {
    82             get
    83             {
    84                 CollectionBase<IEdge> edges = new CollectionBase<IEdge>();
    85                 foreach (IConnection cn in this.CurrentPage.Connections)
    86                 {
    87                     edges.Add(cn as IEdge);
    88                 }
    89                 return edges;
    90             }
    91         }
    92         /// <summary>
    93         /// Get the source Node for the given Edge instance.
    94         /// </summary>
    95         /// <param name="edge"></param>
    96         /// <returns></returns>
    97         INode IGraph.FromNode(IEdge edge)
    98         {
    99             return edge.SourceNode;
    100         }
    101 
    102         INode IGraph.ToNode(IEdge edge)
    103         {
    104             return edge.TargetNode;
    105         }
    106 
    107         /// <summary>
    108         /// Given an Edge and an incident Node, return the other Node
    109         /// connected to the edge.
    110         /// </summary>
    111         /// <param name="edge"></param>
    112         /// <param name="node"></param>
    113         /// <returns></returns>
    114         INode IGraph.AdjacentNode(IEdge edge, INode node)
    115         {
    116             if (edge.SourceNode == node)
    117                 return edge.TargetNode;
    118             else if (edge.TargetNode == node)
    119                 return edge.SourceNode;
    120             else
    121                 throw new InconsistencyException("The node is not a target or source node of the given edge.");
    122 
    123         }
    124 
    125         /// <summary>
    126         /// Gets the collection of all adjacent nodes connected to the given node by an
    127         /// incoming edge (i.e., all nodes that "point" at this one).
    128         /// </summary>
    129         /// <param name="node"></param>
    130         /// <returns></returns>
    131         CollectionBase<INode> IGraph.InNeighbors(INode node)
    132         {
    133             return node.InNeighbors;
    134         }
    135 
    136         /// <summary>
    137         /// Gets the collection of adjacent nodes connected to the given node by an
    138         /// outgoing edge (i.e., all nodes "pointed" to by this one).
    139         /// </summary>
    140         /// <param name="node"></param>
    141         /// <returns></returns>
    142         CollectionBase<INode> IGraph.OutNeighbors(INode node)
    143         {
    144             return node.OutNeighbors;
    145         }
    146 
    147         /// <summary>
    148         /// Get an iterator over all nodes connected to the given node.
    149         /// </summary>
    150         /// <param name="node"></param>
    151         /// <returns></returns>
    152         CollectionBase<INode> IGraph.Neighbors(INode node)
    153         {
    154             return node.Neighbors;
    155         }
    156 
    157         /// <summary>
    158         /// Edgeses the specified node.
    159         /// </summary>
    160         /// <param name="node">The node.</param>
    161         /// <returns></returns>
    162         CollectionBase<IEdge> IGraph.EdgesOf(INode node)
    163         {
    164             return node.Edges;
    165         }
    166 
    167         /// <summary>
    168         /// Ins the edges.
    169         /// </summary>
    170         /// <param name="node">The node.</param>
    171         /// <returns></returns>
    172         CollectionBase<IEdge> IGraph.InEdges(INode node)
    173         {
    174             return node.InEdges;
    175         }
    176 
    177         /// <summary>
    178         /// Outs the edges.
    179         /// </summary>
    180         /// <param name="node">The node.</param>
    181         /// <returns></returns>
    182         CollectionBase<IEdge> IGraph.OutEdges(INode node)
    183         {
    184             return node.OutEdges;
    185         }
    186 
    187 
    188         /// <summary>
    189         /// Gets the spanning tree.
    190         /// </summary>
    191         /// <value>The spanning tree.</value>
    192         ITree IGraph.SpanningTree
    193         {
    194             get { return mSpanningTree; }
    195         }
    196 
    197         /// <summary>
    198         /// Makes the spanning tree.
    199         /// </summary>
    200         /// <param name="node">The node.</param>
    201         /// <returns></returns>
    202         void IGraph.MakeSpanningTree(INode node)
    203         {
    204             // build unweighted spanning tree by BFS
    205             LinkedList<INode> q = new LinkedList<INode>();
    206             BitArray visit = new BitArray(this.CurrentPage.Shapes.Count);
    207             q.AddFirst(node);
    208             visit[this.CurrentPage.Shapes.IndexOf(node as IShape)] = true ;
    209             CollectionBase<IEdge> edges = (this as IGraph).Edges;
    210             INode n;
    211             while (q.Count>0)
    212             {
    213                 INode p = q.First.Value;
    214                 q.RemoveFirst();
    215                 foreach (IEdge edge in p.Edges)
    216                 {
    217                     n = edge.AdjacentNode(p);
    218                     if (n == null) continue;
    219                     try
    220                     {
    221                         if (!visit[this.CurrentPage.Shapes.IndexOf(n as IShape)])
    222                         {
    223                             q.AddLast(n);
    224                             visit[this.CurrentPage.Shapes.IndexOf(n as IShape)] = true;
    225                             n.ParentNode = p;
    226                             n.ParentEdge = edge;
    227                             if (p.Children == null)
    228                                 p.Children = new CollectionBase<INode>();
    229                             if(!p.Children.Contains(n))                    // mkommend 16.02.2010 avoid duplicate children
    230                                 p.Children.Add(n);
    231                         }
    232                     }
    233                     catch (ArgumentOutOfRangeException)
    234                     { continue; }
    235                 }
    236            
    237             }
    238             mSpanningTree = this as ITree;
    239            
    240         }
    241 
    242 
    243         void ITree.ForEach<T>(Action<T> action, INode startNode)
    244         {
    245             (action as Action<INode>).Invoke(startNode);
    246             if (startNode.Children == null)
    247                 return;
    248            
    249             foreach (INode node in startNode.Children)
    250             {                               
    251                 //(action as Action<INode>).Invoke(node);
    252                 (this as ITree).ForEach<INode>((action as Action<INode>), node);
    253             }
    254 
    255         }
    256 
    257 
    258 
    259 
    260         /// <summary>
    261         /// Clears the spanning tree.
    262         /// </summary>
    263         void IGraph.ClearSpanningTree()
    264         {
    265             mSpanningTree = null;
    266         }
    267         IEdge ITree.ParentEdge(INode node)
    268         {
    269             if (mSpanningTree == null)
    270                 return null;
    271             return mSpanningTree.ParentEdge(node);
    272         }
    273 
    274         /// <summary>
    275         /// Indicates if the edges of this graph are directed or undirected.
    276         /// </summary>
    277         /// <value></value>
    278         bool ITree.IsDirected
    279         {
    280             get { return mIsDirected; }
    281             set { mIsDirected = value; }
    282         }
    283 
    284         INode ITree.Root
    285         {
    286             get
    287             {
    288                 return mLayoutRoot as INode;
    289             }
    290             set
    291             {
    292                 mLayoutRoot = value as IShape;
    293             }
    294         }
    295 
    296         CollectionBase<INode> ITree.Children(INode node)
    297         {
    298             if (mSpanningTree == null)
    299                 return null;
    300             return mSpanningTree.Children(node);
    301         }
    302 
    303         CollectionBase<IEdge> ITree.ChildEdges(INode node)
    304         {
    305             if (mSpanningTree == null)
    306                 return null;
    307             return mSpanningTree.ChildEdges(node);
    308         }
    309 
    310         INode ITree.NextSibling(INode node)
    311         {
    312             if (mSpanningTree == null)
    313                 return null;
    314             return  mSpanningTree.NextSibling(node);
    315         }
    316 
    317         INode ITree.PreviousSibling(INode node)
    318         {
    319             if (mSpanningTree == null)
    320                 return null;
    321             return mSpanningTree.PreviousSibling(node);
    322         }
    323 
    324         INode ITree.LastChild(INode node)
    325         {
    326             if (mSpanningTree == null)
    327                 return null;
    328             return mSpanningTree.LastChild(node);
    329         }
    330 
    331         INode ITree.FirstChild(INode node)
    332         {
    333             if (mSpanningTree == null)
    334                 return null;
    335             return mSpanningTree.FirstChild(node);
    336         }
    337 
    338         int ITree.ChildCount(INode node)
    339         {
    340             if (mSpanningTree == null)
    341                 return 0;
    342             return mSpanningTree.ChildCount(node);
    343         }
    344 
    345         int ITree.Depth(INode node)
    346         {
    347             if (mSpanningTree == null)
    348                 return 0;
    349             return mSpanningTree.Depth(node);
    350         }
    351 
    352        
    353     }
     210      }
     211      mSpanningTree = this as ITree;
     212
     213    }
     214
     215
     216    void ITree.ForEach<T>(Action<T> action, INode startNode) {
     217      (action as Action<INode>).Invoke(startNode);
     218      if (startNode.Children == null)
     219        return;
     220
     221      foreach (INode node in startNode.Children) {
     222        //(action as Action<INode>).Invoke(node);
     223        (this as ITree).ForEach<INode>((action as Action<INode>), node);
     224      }
     225
     226    }
     227
     228
     229
     230
     231    /// <summary>
     232    /// Clears the spanning tree.
     233    /// </summary>
     234    void IGraph.ClearSpanningTree() {
     235      mSpanningTree = null;
     236    }
     237    IEdge ITree.ParentEdge(INode node) {
     238      if (mSpanningTree == null)
     239        return null;
     240      return mSpanningTree.ParentEdge(node);
     241    }
     242
     243    /// <summary>
     244    /// Indicates if the edges of this graph are directed or undirected.
     245    /// </summary>
     246    /// <value></value>
     247    bool ITree.IsDirected {
     248      get { return mIsDirected; }
     249      set { mIsDirected = value; }
     250    }
     251
     252    INode ITree.Root {
     253      get {
     254        return mLayoutRoot as INode;
     255      }
     256      set {
     257        mLayoutRoot = value as IShape;
     258      }
     259    }
     260
     261    CollectionBase<INode> ITree.Children(INode node) {
     262      if (mSpanningTree == null)
     263        return null;
     264      return mSpanningTree.Children(node);
     265    }
     266
     267    CollectionBase<IEdge> ITree.ChildEdges(INode node) {
     268      if (mSpanningTree == null)
     269        return null;
     270      return mSpanningTree.ChildEdges(node);
     271    }
     272
     273    INode ITree.NextSibling(INode node) {
     274      if (mSpanningTree == null)
     275        return null;
     276      return mSpanningTree.NextSibling(node);
     277    }
     278
     279    INode ITree.PreviousSibling(INode node) {
     280      if (mSpanningTree == null)
     281        return null;
     282      return mSpanningTree.PreviousSibling(node);
     283    }
     284
     285    INode ITree.LastChild(INode node) {
     286      if (mSpanningTree == null)
     287        return null;
     288      return mSpanningTree.LastChild(node);
     289    }
     290
     291    INode ITree.FirstChild(INode node) {
     292      if (mSpanningTree == null)
     293        return null;
     294      return mSpanningTree.FirstChild(node);
     295    }
     296
     297    int ITree.ChildCount(INode node) {
     298      if (mSpanningTree == null)
     299        return 0;
     300      return mSpanningTree.ChildCount(node);
     301    }
     302
     303    int ITree.Depth(INode node) {
     304      if (mSpanningTree == null)
     305        return 0;
     306      return mSpanningTree.Depth(node);
     307    }
     308
     309
     310  }
    354311}
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Analysis/ShapeBase.Analysis.cs

    r2768 r2875  
    3535        public bool IsExpanded
    3636        {
    37             get { return mIsExpanded; }
     37            get { return treeChildren.Count != 0; }
    3838            set { mIsExpanded = value; }
    3939        }
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/OperatorGraphVisualizationInfo.cs

    r2869 r2875  
    4848      this.operatorGraph = operatorGraph;
    4949      this.operatorGraph.InitialOperatorChanged += new EventHandler(operatorGraph_InitialOperatorChanged);
     50      operatorGraph.Operators.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsAdded);
     51      operatorGraph.Operators.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsRemoved);
     52      operatorGraph.Operators.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_CollectionReset);
     53
    5054      foreach (IOperator op in operatorGraph.Operators)
    5155        if (!this.shapeInfoMapping.ContainsFirst(op))
    5256          this.AddOperator(op);
    5357
    54       operatorGraph.Operators.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsAdded);
    55       operatorGraph.Operators.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_ItemsRemoved);
    56       operatorGraph.Operators.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IOperator>(Operators_CollectionReset);
     58      this.UpdateInitialShape();
    5759    }
    5860
    5961    public event EventHandler InitialShapeChanged;
    6062    private void operatorGraph_InitialOperatorChanged(object sender, EventArgs e) {
     63      this.UpdateInitialShape();
     64    }
     65
     66    private void UpdateInitialShape() {
     67      OperatorShapeInfo old = this.oldInitialShape as OperatorShapeInfo;
     68      if (old != null)
     69        old.HeadColor = oldInitialShapeColor;
     70
     71      OperatorShapeInfo newInitialShapeInfo = this.InitialShape as OperatorShapeInfo;
     72      if (newInitialShapeInfo != null) {
     73        oldInitialShapeColor = newInitialShapeInfo.HeadColor;
     74        newInitialShapeInfo.HeadColor = Color.LightGreen;
     75      }
     76
     77      oldInitialShape = this.InitialShape;
    6178      if (this.InitialShapeChanged != null)
    6279        this.InitialShapeChanged(this, new EventArgs());
    6380    }
    6481
     82    private IShapeInfo oldInitialShape;
     83    private Color oldInitialShapeColor;
    6584    public IShapeInfo InitialShape {
    6685      get {
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/Model/ShapeInfoFactory.cs

    r2872 r2875  
    4343      operatorShapeInfo.Title = op.Name;
    4444      operatorShapeInfo.Text = op.GetType().ToString();
     45      operatorShapeInfo.HeadColor = Color.LightBlue;
    4546
    4647      return operatorShapeInfo;
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.cs

    r2872 r2875  
    9797      if (shapeInfo != null)
    9898        this.graphVisualization.Controller.Model.LayoutRoot = this.shapeInfoShapeMapping.GetByFirst(shapeInfo);
    99       else
     99       else
    100100        this.graphVisualization.Controller.Model.LayoutRoot = null;
    101101    }
     
    281281      IShape shape = this.shapeInfoShapeMapping.GetByFirst(shapeInfo);
    282282      shapeInfo.UpdateShape(shape);
     283      shape.Invalidate();
    283284    }
    284285
     
    334335    #region methods for toolbar items
    335336
    336     private int layoutCount = 0;
    337337    internal void RelayoutOperatorGraph() {
    338       if (this.shapeInfoShapeMapping.Count > 0 && this.connectionConnectorsMapping.Count > 0) { //otherwise the layout does not work
    339 
    340         string layoutName = string.Empty;
    341         switch (this.layoutCount % 6) {
    342           case 0: { layoutName = "Random Layout"; break; }
    343           case 1: { layoutName = "FruchtermanReingold Layout"; break; }
    344           case 2: { layoutName = "Standard TreeLayout"; break; }
    345           case 3: { layoutName = "Radial TreeLayout"; break; }
    346           case 4: { layoutName = "Balloon TreeLayout"; break; }
    347           case 5: { layoutName = "ForceDirected Layout"; break; }
    348         }
     338      if (this.shapeInfoShapeMapping.Count > 0
     339        && this.connectionConnectorsMapping.Count > 0
     340        && this.VisualizationInfo.InitialShape != null) { //otherwise the layout does not work
     341        string layoutName = "Standard TreeLayout";
    349342        this.graphVisualization.Controller.RunActivity(layoutName);
    350         MessageBox.Show(layoutName);
    351         this.layoutCount++;
    352343        this.graphVisualization.Invalidate();
    353344      }
Note: See TracChangeset for help on using the changeset viewer.