<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hi all,<br>
    <br>
    I'm trying to connect a <small>vtkQtTree</small> and a <small>vtkGraphLayout</small>
    but the selection is not working as expected.<br>
    <br>
    When I select something in the <small>vtkGraphLayout</small>, the
    selection can contain vertices and edges.<br>
    When I select something in the <small>vtkQtTree</small>, the
    selection only contains vertices.<br>
    <br>
    If I select edges + vertices in the <small>vtkGraphLayout</small>,
    i.e. vertices: 1 and 4, edge:3, it highlights <u>vertices</u> 1,3,4
    in the <small>vtkQtTree</small>...<br>
    <br>
    Then I have 3 questions/issues:<br>
    (see pseudo-code at the end of the email)<br>
    <br>
    #1: should I modify the structure of my <small>vtkTree</small> (<small>Add
      specific arrays for vertices/edges?</small>) so the <small>vtkQtTree</small>
    handles properly selection of edges+vertices?<br>
    <br>
    #2: can I get my <small>vtkQtTree</small> to return the edges? Or
    should I find the edges after it returns the vertices (is there an
    efficient way to do it?)?<br>
    <br>
    #3: is there a straight forward way to disable edges selection in
    the <small>vtkGraphLayoutView</small>? <small>(Something like:
      EdgesNotSelectable()?)</small><br>
    <br>
    <br>
    Thanks,<br>
    <br>
    <br>
    Nicolas<br>
    <br>
    <br>
    // What I do<br>
    <br>
    I first create a graph and add some arrays associated to the <u>vertices</u>.
    <br>
    <small>&nbsp; vtkSmartPointer&lt;vtkMutableDirectedGraph&gt; graph =<br>
      &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkMutableDirectedGraph&gt;::New();<br>
      &nbsp; vtkIdType a = graph-&gt;AddVertex();<br>
      &nbsp; vtkIdType b = graph-&gt;AddChild(a);<br>
      &nbsp; vtkIdType c = graph-&gt;AddChild(a);<br>
      <br>
      &nbsp; vtkSmartPointer&lt;vtkStringArray&gt; cellType =<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkStringArray&gt;::New();<br>
      &nbsp; cellType-&gt;SetName("name");<br>
      &nbsp; cellType-&gt;InsertValue(a, "TypeA");<br>
      &nbsp; cellType-&gt;InsertValue(b, "TypeB");<br>
      &nbsp; cellType-&gt;InsertValue(c, "TypeC");<br>
      <br>
      &nbsp; graph-&gt;GetVertexData()-&gt;AddArray(cellType);<br>
      ...<br>
    </small><br>
    I convert the graph to a <small>vtkTree</small> and add this
    representation to the <small>vtkQtTree</small> and to the <small>vtkGraphLayout</small>.<br>
    <br>
    I connect the views through <small>vtkAnnotations</small> and <small>vtkEventQtSlotConnect</small>.<br>
    <small>&nbsp; this-&gt;m_annotationLink =
      vtkSmartPointer&lt;vtkAnnotationLink&gt;::New();<br>
      &nbsp;
this-&gt;m_treeGraphView-&gt;GetRepresentation()-&gt;SetAnnotationLink(this-&gt;m_annotationLink);<br>
      &nbsp;
this-&gt;m_treeTableView-&gt;GetRepresentation()-&gt;SetAnnotationLink(this-&gt;m_annotationLink);</small><br>
    <br>
    <small>&nbsp; this-&gt;m_connect =
      vtkSmartPointer&lt;vtkEventQtSlotConnect&gt;::New();<br>
      &nbsp;
this-&gt;m_connect-&gt;Connect(this-&gt;m_treeTableView-&gt;GetRepresentation(),<br>
      &nbsp;&nbsp;&nbsp; vtkCommand::SelectionChangedEvent,<br>
      &nbsp;&nbsp;&nbsp; this, SLOT(selectionChanged(vtkObject*, unsigned long, void*,
      void*)));<br>
      &nbsp;
this-&gt;m_connect-&gt;Connect(this-&gt;m_treeGraphView-&gt;GetRepresentation(),<br>
      &nbsp;&nbsp;&nbsp; vtkCommand::SelectionChangedEvent,<br>
      &nbsp;&nbsp;&nbsp; this, SLOT(selectionChanged(vtkObject*, unsigned long, void*,
      void*)));</small><br>
    <br>
    <small>selectionChanged() only call update on the 2 views</small><br>
  </body>
</html>