[vtkusers] connection vtkQtTree - vtkGraphLayoutView

Nicolas Rannou nicolas_rannou at hms.harvard.edu
Tue Mar 15 18:28:11 EDT 2011


Hi Jeff,

another thing we noticed is that the root vertex is not shown in the 
vtkQtTreeView. Is there any reason for that or is it a bug?

If "A" is the tree root vertex:

vtkGraphLayoutView:

A--->B--->C--->D
     |        |
     |        ->E
     ->F

vtkQtTreeView:

B--->C--->D
     |
     ->E
F

Thanks,


Nicolas

On 03/14/2011 02:36 PM, Nicolas Rannou wrote:
> Thanks for the feedback Jeff,
>
> I added it in the bug tracker. 
> (http://public.kitware.com/Bug/view.php?id=11969)
>
> I'll submit a patch for the vtkGraphLayoutView in the next days.
>
> Thanks,
>
> Nicolas
>
> On 03/14/2011 01:12 PM, Jeff Baumes wrote:
>> Glancing at your message again, it appears you are also finding a bug 
>> in vtkQtTreeView where it interprets edge ids as vertex ids. If you 
>> could add that to the VTK bug tracker, I could hopefully take a look 
>> at it sometime soon. Getting rid of edge selections in the graph 
>> layout view as I suggested would work around this problem.
>>
>> On Mon, Mar 14, 2011 at 1:07 PM, Jeff Baumes <jeff.baumes at kitware.com 
>> <mailto:jeff.baumes at kitware.com>> wrote:
>>
>>     I do not know of a simple way to make this difference in
>>     selections go away. The vtkGraphLayoutView generates vertex +
>>     edge selections, and vtkQtTreeView generates vertex-only
>>     selections. I believe the best solution is to have
>>     vtkGraphLayoutView have an option to not select edges, as you
>>     suggested. If you are interested in adding that option, you can
>>     patch vtkGraphLayoutView.cxx to add some checks in
>>     ConvertSelection() based on a new boolean member variable and
>>     submit it to us for inclusion in VTK, or you could subclass
>>     vtkGraphLayoutView and reimplement ConvertSelection() if you want
>>     to just get it working for your own application.
>>
>>     Jeff
>>
>>     On Fri, Mar 11, 2011 at 4:41 PM, Nicolas Rannou
>>     <nicolas_rannou at hms.harvard.edu
>>     <mailto:nicolas_rannou at hms.harvard.edu>> wrote:
>>
>>         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
>>
>>         _______________________________________________
>>         Powered by www.kitware.com <http://www.kitware.com>
>>
>>         Visit other Kitware open-source projects at
>>         http://www.kitware.com/opensource/opensource.html
>>
>>         Please keep messages on-topic and check the VTK FAQ at:
>>         http://www.vtk.org/Wiki/VTK_FAQ
>>
>>         Follow this link to subscribe/unsubscribe:
>>         http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>>
>>
>>     -- 
>>     Jeff Baumes, Ph.D.
>>     Technical Lead, Kitware Inc.
>>     (518) 881-4932
>>
>>
>>
>>
>> -- 
>> Jeff Baumes, Ph.D.
>> Technical Lead, Kitware Inc.
>> (518) 881-4932
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110315/37ab8073/attachment.htm>


More information about the vtkusers mailing list