[vtkusers] connection vtkQtTree - vtkGraphLayoutView
Nicolas Rannou
nicolas_rannou at hms.harvard.edu
Fri Mar 11 16:41:39 EST 2011
Hi all,
I'm trying to connect a vtkQtTree and a vtkGraphLayout but the selection
is not working as expected.
When I select something in the vtkGraphLayout, the selection can contain
vertices and edges.
When I select something in the vtkQtTree, the selection only contains
vertices.
If I select edges + vertices in the vtkGraphLayout, i.e. vertices: 1 and
4, edge:3, it highlights _vertices_ 1,3,4 in the vtkQtTree...
Then I have 3 questions/issues:
(see pseudo-code at the end of the email)
#1: should I modify the structure of my vtkTree (Add specific arrays for
vertices/edges?) so the vtkQtTree handles properly selection of
edges+vertices?
#2: can I get my vtkQtTree to return the edges? Or should I find the
edges after it returns the vertices (is there an efficient way to do it?)?
#3: is there a straight forward way to disable edges selection in the
vtkGraphLayoutView? (Something like: EdgesNotSelectable()?)
Thanks,
Nicolas
// What I do
I first create a graph and add some arrays associated to the _vertices_.
vtkSmartPointer<vtkMutableDirectedGraph> graph =
vtkSmartPointer<vtkMutableDirectedGraph>::New();
vtkIdType a = graph->AddVertex();
vtkIdType b = graph->AddChild(a);
vtkIdType c = graph->AddChild(a);
vtkSmartPointer<vtkStringArray> cellType =
vtkSmartPointer<vtkStringArray>::New();
cellType->SetName("name");
cellType->InsertValue(a, "TypeA");
cellType->InsertValue(b, "TypeB");
cellType->InsertValue(c, "TypeC");
graph->GetVertexData()->AddArray(cellType);
...
I convert the graph to a vtkTree and add this representation to the
vtkQtTree and to the vtkGraphLayout.
I connect the views through vtkAnnotations and vtkEventQtSlotConnect.
this->m_annotationLink = vtkSmartPointer<vtkAnnotationLink>::New();
this->m_treeGraphView->GetRepresentation()->SetAnnotationLink(this->m_annotationLink);
this->m_treeTableView->GetRepresentation()->SetAnnotationLink(this->m_annotationLink);
this->m_connect = vtkSmartPointer<vtkEventQtSlotConnect>::New();
this->m_connect->Connect(this->m_treeTableView->GetRepresentation(),
vtkCommand::SelectionChangedEvent,
this, SLOT(selectionChanged(vtkObject*, unsigned long, void*, void*)));
this->m_connect->Connect(this->m_treeGraphView->GetRepresentation(),
vtkCommand::SelectionChangedEvent,
this, SLOT(selectionChanged(vtkObject*, unsigned long, void*, void*)));
selectionChanged() only call update on the 2 views
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110311/aa39f095/attachment.htm>
More information about the vtkusers
mailing list