<!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> vtkSmartPointer<vtkMutableDirectedGraph> graph =<br>
vtkSmartPointer<vtkMutableDirectedGraph>::New();<br>
vtkIdType a = graph->AddVertex();<br>
vtkIdType b = graph->AddChild(a);<br>
vtkIdType c = graph->AddChild(a);<br>
<br>
vtkSmartPointer<vtkStringArray> cellType =<br>
vtkSmartPointer<vtkStringArray>::New();<br>
cellType->SetName("name");<br>
cellType->InsertValue(a, "TypeA");<br>
cellType->InsertValue(b, "TypeB");<br>
cellType->InsertValue(c, "TypeC");<br>
<br>
graph->GetVertexData()->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> this->m_annotationLink =
vtkSmartPointer<vtkAnnotationLink>::New();<br>
this->m_treeGraphView->GetRepresentation()->SetAnnotationLink(this->m_annotationLink);<br>
this->m_treeTableView->GetRepresentation()->SetAnnotationLink(this->m_annotationLink);</small><br>
<br>
<small> this->m_connect =
vtkSmartPointer<vtkEventQtSlotConnect>::New();<br>
this->m_connect->Connect(this->m_treeTableView->GetRepresentation(),<br>
vtkCommand::SelectionChangedEvent,<br>
this, SLOT(selectionChanged(vtkObject*, unsigned long, void*,
void*)));<br>
this->m_connect->Connect(this->m_treeGraphView->GetRepresentation(),<br>
vtkCommand::SelectionChangedEvent,<br>
this, SLOT(selectionChanged(vtkObject*, unsigned long, void*,
void*)));</small><br>
<br>
<small>selectionChanged() only call update on the 2 views</small><br>
</body>
</html>